Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > UnsubscribeMailBox Method
ContentsIndexHome
PreviousUpNext
TIdIMAP4.UnsubscribeMailBox Method

Removes a mailbox from the list of "active" or "subscribed" mailboxes.

function UnsubscribeMailBox(
    const AMBName: String
): Boolean;
Parameters 
Description 
AMBName 
Mailbox name to removed from the active or subscribed list. 

Boolean - True on success.

UnsubscribeMailBox is a Boolean function used to remove the mailbox name specified in AMBName from the list of "active" or "subscribed" mailboxes on the IMAP4 server. UnsubscribeMailBox updates the values that are returned by the IMAP4 LSUB command. 

UnsubscribeMailBox requires that the ConnectionState for the client contain the value csAuthenticated or csSelected to perform the IMAP4 function. SubscribeMailBox can raise an EIdConnectionStateError exception with the message RSIMAP4ConnectionStateError if ConnectionState contains a value other than csAuthenticated or csSelected. 

UnsubscribeMailBox calls sends the IMAP4 UNSUBSCRIBE command and the value specified in AMBName as an argument. UnsubscribeMailBox returns True when the response code from the IMAP4 server is IMAP_OK

Use SubscribeMailBox to add a specified mailbox from the "active" or "subscibed" list. 

Please note that IMAP4 servers are required to have an "Inbox" folder to allow receipt of email for a given user. This may or may not be case-sensitive. Your implementation may require you to create an Inbox folder if it does not already exist. 

Also, caution is advised when choosing the characters used for mailbox names. Different IMAP servers may allow, and interpret differently, various characters, which is allowed within the IMAP specification. Characters such as ~ / and . may have special meaning in the IMAP servers context, and may produce unexpected results. In practice, some IMAP servers may be case-sensitive and others not. It is recommended that you only use the characters A-Z and 0-9 and that you program to allow for case sensitivity or insensitivity, as applicable. Note that, in general, IdIMAP4 adds double-quotes around mailbox names, which allows the use of spaces in mailbox names, but also note that a perticular IMAP server may not allow spaces (this functionality is necessary to allow IdIMAP4 deal with pre-existing mailboxes that include spaces).

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.