Unselects the currently selected folder and optionally removes all messages having \Deleted flag set from the folder.
true if the folder was unselected successfully; otherwise, false.
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 Another way of keeping messages marked as deleted without expunging them is calling Disconnect method or selecting another folder using SelectFolder or ExamineFolder 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.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
Imap Class | MailBee.ImapMail Namespace | Imap.Close Overload List | SelectFolder | Expunge