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.
Does the Aspose.Email library supports the IMAP IDLE command?
Hi Frank,
Hi Frank,
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