ImapClose Method (Boolean)
Unselects the currently selected folder and optionally removes all messages having \Deleted flag set from the folder.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public bool Close(
	bool expungeDeleted


Type: SystemBoolean
If true, the messages marked as deleted will be permanently removed from the folder.

Return Value

Type: Boolean
true if the folder was unselected successfully; otherwise, false.
MailBeeExceptionAn error occurred and ThrowExceptions is true.

If expungeDeleted is true, this method sends CLOSE command to the IMAP4 server. This commands expunges all messages marked as deleted from the selected folder, and then unselects the folder.

If expungeDeleted is false, this method simply unselects the currently selected folder. No messages are expunged. Unselecting is performed either via UNSELECT command if the server supports UNSELECT capability or via SELECT command without argument if UNSELECT capability is not supported.

Note Note
Another way of keeping messages marked as deleted without expunging them is calling Disconnect method or selecting another folder using SelectFolder(String) or ExamineFolder(String) method. Close(false) should only be used when the developer needs to close the current folder but retain the connection and do not select another folder.
See Also