Author |
|
Yoonoo Newbie
Joined: 03 December 2006
Online Status: Offline Posts: 5
|
Posted: 03 December 2006 at 6:55pm | IP Logged
|
|
|
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 |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 04 December 2006 at 9:18am | IP Logged
|
|
|
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 |
|
|
Yoonoo Newbie
Joined: 03 December 2006
Online Status: Offline Posts: 5
|
Posted: 27 December 2006 at 8:11pm | IP Logged
|
|
|
Thanks Andrew. I was able to get the IMAP Idle working with the new version.
|
Back to Top |
|
|