ImapDeleteMessages Method |
Namespace: MailBee.ImapMail
Exception | Condition |
---|---|
MailBeeException | An error occurred and ThrowExceptions is true. |
To learn how to specify a valid message sequence (messageIndexSet value), see DownloadEnvelopes(String, Boolean) topic.
Note |
---|
This method just sets "\Deleted" flag for the specified messages. To purge deleted messages permanently, call Expunge(String, Boolean) method or explicitly unselect the folder using Close(Boolean) method. |
To learn now to undelete messages marked as deleted, see the sample in SetMessageFlags(String, Boolean, SystemMessageFlags, MessageFlagAction) topic.
using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { Imap imp = new Imap(); // Connect to the server, login and select inbox. imp.Connect("mail.server.com"); imp.Login("jdoe", "secret"); imp.SelectFolder("INBOX"); // Mark messages as deleted. imp.DeleteMessages("1,5:7", false); // Uncomment the next line to purge deleted messages. // imp.Close(); // Disconnect from the server. imp.Disconnect(); } }