Indy 9 | Content | Index | Reference

SearchMailBox
See Also
Searches for messages in the current mailbox using the specified search criteria.
Return Value
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 numeric protocol response in LastCmdResult contains the value wsOk.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.