Retrieving new messages |
Upon establishing a connection to a IMAP server you can retrieve all new messages in the account mailbox by invoking the GetNewMessages method. Any messages found are returned as an Enumeration.
Note
New messages are messages received since the last time the account was accessed.
Example
[C#] myImap.Connect(); IEnumerator e = myImap.GetNewMessages(); while(e.MoveNext()) { EmailMessage message = (EmailMessage)e.Current; // write out message subject Console.Writeline(message.GetSubject()); }
[Visual Basic] myImap.Connect() Dim e As IEnumerator = myImap.GetNewMessages() Dim message As EmailMessage = Nothing While (e.MoveNext()) message = e.Current ' write out message subject Console.WriteLine(message.GetSubject()) End While
|