MailBee.NET Objects 4.0

Imap.Close Method (Boolean)

Unselects the currently selected folder and optionally removes all messages having \Deleted flag set from the folder.

public bool Close(
   bool expungeDeleted
);

Parameters

expungeDeleted
If true, the messages marked as deleted will be permanently removed from the folder.

Return Value

true if the folder was unselected successfully; otherwise, false.

Remarks

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.

Exceptions

Exception TypeCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.

See Also

Imap Class | MailBee.ImapMail Namespace | Imap.Close Overload List | SelectFolder | Expunge