imap_search

imap_search -- This function returns an array of messages matching the given search criteria.

Description

array imap_search(int imap_stream, string criteria, int flags);

This function performs a search on the mailbox currently opened in the given imap stream. criteria is a string, delimited by spaces, in which the following keywords are allowed. Any multi-word arguments (eg FROM "joe smith") must be quoted.

For example, to match all unanswered messages sent by Mom, you'd use: "UNANSWERED FROM mom". Searches appear to be case insensitive. This list of criteria is from a reading of the UW c-client source code and may be uncomplete or inaccurate. Searcher beware.

Valid values for flags are SE_UID, which causes the returned array to contain UIDs instead of messages sequence numbers.