IMAP Idle command

Does the Aspose.Email library supports the IMAP IDLE command?

We want the capability to open a connection and wait for e-mail to arrive, instead of having to poll the mail server periodically.

Hi Frank,


Thank you for writing to Aspose support team.

I have searched the available documents but could not find any information about the availability of Imap IDLE command. Please spare us little time while we are further analyzing the requirement, and will write back here soon to share our findings.

Hi Frank,


We have logged this requirement as enhancement in our issue tracking system with id: EMAILNET-34875. We shall notify you here once the fix version for this issue is available for download.

Hi Frank,

We are glad to share with you that the API now provides this feature of IMAP IDLE command. Please use the StartMonitoring and StopMonitoring methods of ImapClient to get notified about the events when a new message arrives. It shows what happens when we use StartMonitoring and StopMonitoring. Please let us know if we can be of any additional help to you.

Code:

using (ImapClient imapClient = new ImapClient(“[exchange.daomin.com](http://exchange.daomin.com/)”, “username”, “password”))

using (SmtpClient smtpClient = new SmtpClient(“[exchange.domain.com](http://exchange.domain.com/)”, “username”, “password”))

{

imapClient.SelectFolder(ImapFolderInfo.InBox);

try

{

ManualResetEvent evnt = new ManualResetEvent(false);

ImapMonitoringEventArgs eventArgs = null;

imapClient.StartMonitoring(delegate(object sender, ImapMonitoringEventArgs e)

{

eventArgs = e;

evnt.Set();

});

Thread.Sleep(2000);

smtpClient.Send(new MailMessage(

"from@aspose.com",

"to@aspose.com",

“EMAILNET-34875 - " + Guid.NewGuid().ToString(),

“EMAILNET-34875 Support for IMAP idle command”));

bool b = evnt.WaitOne(20000);

Console.WriteLine(b);

evnt.Reset();

Console.WriteLine(eventArgs.NewMessages.Length);

Console.WriteLine(eventArgs.DeletedMessages.Length);

smtpClient.Send(new MailMessage(

"from@aspose.com”,

"to@aspose.com",

“EMAILNET-34875 - " + Guid.NewGuid().ToString(),

“EMAILNET-34875 Support for IMAP idle command”));

b = evnt.WaitOne(20000);

Console.WriteLine(b);

evnt.Reset();

Console.WriteLine(eventArgs.NewMessages.Length);

Console.WriteLine(eventArgs.DeletedMessages.Length);

imapClient.StopMonitoring(“Inbox”);

smtpClient.Send(new MailMessage(

"from@aspose.com”,

"to@aspose.com",

"EMAILNET-34875 - " + Guid.NewGuid().ToString(),

“EMAILNET-34875 Support for IMAP idle command”));

Console.WriteLine(evnt.WaitOne(5000));

}

finally

{

}

}

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan