Internet Direct (Indy) Version 9.0.1 Beta
TIdIMAP4.SearchMailBox
Searches for messages in the current mailbox using the specified search criteria.

function SearchMailBox(const ASearchInfo: array of TIdIMAP4SearchRec): Boolean;
Parameters
const ASearchInfo: array of TIdIMAP4SearchRec
Serach criteria to use in searching mailbox messages.

Returns
Boolean - True on success.

Description
SearchMailBox is a Boolean function that searches for messages in the currently selected mailbox using the specified search criteria specified in ASearchInfo.

SearchMailBox requires that ConnectionState contain the value csSelected, or an EIdConnectionStateError exception will be raised.

SearchMailBox constructs a search query, using the search keys in ASearchInfo, and calls SendCmd using the IMAP4 SEARCH command using the specified search criteria. Date values in the TIdIMAP4SearchRec specified by ASearchInfo are represented using the ShortDateFormat 'dd-MMM-yyyy' and the date separator '-'. SearchMailBox calls ParseSearchResultDetails to load values in CmdResultDetails into Mailbox.

SearchMailBox sets the reurn value for the method to True when ResultNo contains the value wsOk.