ImapClose Method |
Namespace: MailBee.ImapMail
Exception | Condition |
---|---|
MailBeeException | An error occurred and ThrowExceptions is true. |
To avoid expunging messages marked as deleted, the developer should not call this method and simply close the connection with Disconnect method. Another way is to select a different folder or simply unselect the current folder using Close(false) call.
To expunge messages marked as deleted without unselecting the current folder, Expunge(String, Boolean) method should be called.
using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { Imap imp = new Imap(); // Connect to the server and log in the account. imp.Connect("imap.company.com"); imp.Login("jdoe", "secret"); // Select Sent folder. imp.SelectFolder("Sent"); // Mark message #1 as deleted. imp.SetMessageFlags("1", false, SystemMessageFlags.Deleted, MessageFlagAction.Add); // Close the folder and expunge deleted messages. imp.Close(); // Disconnect from the server. imp.Disconnect(); } }