Internet Direct (Indy) Version 9.0.1 Beta
TIdIMAP4.DeleteMailBox
Removes the specified mailbox on the IMAP4 server.

function DeleteMailBox(const AMBName: String): Boolean;
Parameters
const AMBName: String
Mailbox to be removed.

Returns
Boolean - True on success.

Description
DeleteMailBox is a Boolean function that permanently removes the mailbox specified in AMBName from the IMAP4 server. Attempting to remove the "INBOX" mailbox, or a mailbox name that does not exist, will result in an error response from the server.

DeleteMailBox requires that the value of ConnectionState contain either csAuthenticated or csSelected, or an EIdConnectionStateError exception will be raised.

DeleteMailBox calls SendCmd using the IMAP DELETE Command, and sets the return value to True when ResultNo contains wsOk.