We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How do I delete a specific message using Aspose.Email.Imap?


How do I delete a specific message? Which is more reliable passing the sequence number or the unique id to the DeleteMessage() method?

After deleting the messages in a loop, do I have to call ImapClient.CommitDeletes() or not? What does this method anyway?

Best regards


Hi Andreas,

Thank you for contacting Aspose Support team.

The Sequence number represents listing of the messages in mailbox starting from the top and changes as new messages are received. The unique id, on the other hand, remains unique for each message. If you are managing information as meta-data, the unique id should be used as the sequence number is just a mere representation of the messages listing.

The CommitDeletes method tells the server to delete the messages that are marked for deletion on the server. It is like an explicit call to the server for deleting all the messages. You should call the CommitDeletes method after deleting the messages in loop.