Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: IMAP IDLE Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Yoonoo
Newbie
Newbie


Joined: 03 December 2006
Online Status: Offline
Posts: 5
Posted: 03 December 2006 at 6:55pm | IP Logged Quote Yoonoo

Hello, does MailBee .NET IMAP support the IDLE extension? I am able to send the custom command to the server, I receive a positive response but the DataReceived event does not trigger when the server sends a notificatio for new mail. I know the server sends the notification because I can see it through a protocol analyzer (Ethereal).

Below is a code snippet:



        Mail = New MailBee.ImapMail.Imap
        Mail.Connect(Server, PortNumber)
        Mail.Login("yoonoo", "*****", MailBee.AuthenticationMethods.Auto)
        MailResult = Mail.SelectFolder("INBOX")

        If UCase(Mail.GetExtension("IDLE")) = "IDLE" Then
             MailResult = Mail.ExecuteCustomCommand("IDLE", String.Empty)
        End If
Back to Top View Yoonoo's Profile Search for other posts by Yoonoo
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 04 December 2006 at 9:18am | IP Logged Quote Andrew

Yes, MailBee.NET Objects 3.0 supports IDLE extension. Please download MailBee.NET Objects 3.0 Release Candidate and use the sample below:

Code:
bool finished = false;
bool started = false;

private void imp_Idling(object sender, ImapIdlingEventArgs e)
{
        Application.DoEvents();
        if (finished)
        {
                 ((Imap)sender).StopIdle();
                 button1.Text = "Go idle";
        }
}

private void imp_MessageStatus(object sender, ImapMessageStatusEventArgs e)
{
        ((Imap)sender).Log.WriteLine("Got " + e.StatusID + " status update");
}

// Add button1 on the form to make this sample working.
private void button1_Click(object sender, System.EventArgs e)
{
        if (started)
        {
                 finished = true;
        }
        else
        {
                 started = true;

                 Imap imp = new Imap();

                 imp.Log.Filename = @"C:\log.txt";
                 imp.Log.Enabled = true;
                 imp.Log.Clear();

                 // Connect to the server, login and select inbox.
                 imp.Connect("mail.domain.com");
                 imp.Login("user", "pass");
                 imp.SelectFolder("Inbox");

                 imp.Idling += new ImapIdlingEventHandler(imp_Idling);
                 imp.MessageStatus +=new ImapMessageStatusEventHandler(imp_MessageStatus);

                 button1.Text = "Stop idle";

                 // Go idle.
                 imp.Idle();

                 // Disconnect from the server.
                 imp.Disconnect();

                 started = false;
        }
}


You should insert this code into a C# WinForms application and add button "button1" with label "Go idle". Pressing this button makes the sample to work. All notifications are written to the log file. Pressing the button again finishes IDLE. It's also may be useful to perform GetExtension("IDLE") check as in your sample above.



Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
Yoonoo
Newbie
Newbie


Joined: 03 December 2006
Online Status: Offline
Posts: 5
Posted: 27 December 2006 at 8:11pm | IP Logged Quote Yoonoo

Thanks Andrew. I was able to get the IMAP Idle working with the new version.
Back to Top View Yoonoo's Profile Search for other posts by Yoonoo
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide