Deleting all messages |
Upon disconnecting from a IMAP server you can optionally delete any messages retrieved from the account mailbox during your session by setting the DeleteMessages property prior to retrieving any messages from the mailbox.
Note
To delete any messages marked for deletion you must invoke the Expunge method.
Example
[C#] myImap.Connect(); // set delete flag myImap.DeleteMessages = true; IEnumerator e = myImap.GetMessages(); while(e.MoveNext()) { EmailMessage em = (EmailMessage)e.Current; // process email messages } // now delete messages myImap.Expunge(); myImap.Disconnect();
[Visual Basic] myImap.Connect() ' set delete flag myImap.DeleteMessages = True Dim e As IEnumerator = myImap.GetMessages() Dim message As EmailMessage = Nothing While (e.MoveNext()) message = e.Current ' process email messages End While ' now delete messages myImap.Expunge() myImap.Disconnect()
|