Topic Path: Pending > TIdIMAP4.ListMailBoxes@TStringList
ContentsIndexHome
PreviousUpNext
TIdIMAP4.ListMailBoxes@TStringList

Retrieves a list of mailboxes for the IMAP4 account.

Parameters 
Description 
AMailBoxList 
Receives the list of mailboxes for the account. 

Boolean - True on success.

ListMailBoxes is a Boolean function that retrieves a list of mailboxes for the IMAP4 account. ListMailBoxes requires that the value of ConnectionState be csAuthenticated or csSelected, or an EIdConnectionStateError exception will be raised. 

ListMailBoxes calls SendCmd using the IMAP4 LIST command for all mailboxes in the currently selected folder. ListMailBoxes calls parses the results and stores the mailboxes information in LastCmdResult to the AMailBoxList variable. 

Please note that IMAP4 servers are required to have an "Inbox" folder to allow them to receive 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. 

WARNING: 

Be careful with the characters you use 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). 

ListMailBoxes sets the return value to True when the protocol numeric response code contains the value wsOk.

ConnectionState EIdConnectionStateError

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