This project is read-only.

How to implement MessageRetrieved event for IMAP

Oct 1, 2014 at 10:34 AM
Edited Oct 20, 2014 at 11:38 AM
Hi,

I am new to MailSystem.NET. I am trying to implement something that trigger an event when any email received configured for IMAP. I can connect, login and check mails using below code:
Imap4Client imap = new Imap4Client();
if (!imap.IsConnected)
{
    string ok = imap.ConnectSsl(ConfigValues.RemoteAddress, ConfigValues.DataPort);
    ok = imap.Login(ConfigValues.Login, ConfigValues.Password);
 }

 inbox = imap.SelectMailbox("inbox");
 messages = inbox.SearchParse("UNSEEN");
I have put one timer and checking unseen emails every 'x' mins.

So, this is working good for now. But during coding I found one event "MessageRetrieved" of Imap4Client object. Just curious how to implement this event and when it will be fire? Is it possible to remove my timer object and use this event only so when new mail received this event get fire and I get new mail message in this event.

Thanks for your help in advance.