Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.StatusMailBox Method (String, TIdMailBox)

Retrieves status data items for the specified mailbox.

Pascal
function StatusMailBox(
    const AMBName: String; 
    AMB: TIdMailBox
): Boolean; overload;
Parameters 
Description 
AMBName 
Mailbox name tio be accessed and loaded.
 
AMB 
Represents the contents read from the mailbox. 

Boolean - True on success.

StatusMailBox is an overloaded Boolean function used to retrieve status data items specified in AStatusDataItems for the mailbox specified in AMBName. 

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

StatusMailBox calls SendCmd using the IMAP4 STATUS command for the specified mailbox name and data items. On succesful completion, StatusMailBox parses the server response and loads values in the server response into the Mailbox specified in AMB. 

It is pointless calling StatusMailBox with an empty array of mail data items because you are asking the IMAP4 server to update none of the status flags. Instead, the standard flags returned by SelectMailBox are used for the requested mail data items to check if the mailbox has changed. In this situation, the array of TIdIMAP4StatusDataItem includes the following values: 

 

mdMessages 
mdRecent 
mdUIDNext 
mdUIDValidity 
mdUnseen 

 

Please note that IMAP 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. 

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). 

StatusMailBox sets the return value for the method to True when the server response contains the value IMAP_OK.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.