4D v13.2IMAP_Search |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.2
IMAP_Search
IMAP_Search
The IMAP_Search command searches for messages that match the given search criteria in the current mailbox. searchCriteria consists of one or more search keys. msgNumArray returns a listing of message sequence numbers corresponding to those messages that match the search criteria. imap_ID is a long integer reference to an open connection created with IMAP_Login. searchCriteria is a text parameter listing one or more search keys (see “Authorized search keys” at the end of this paragraph) associated or not with values to look for. A search key may be a single item or can also be a parenthesized list of one or more search keys. For example: SearchKey1 = FLAGGED Note: Matching is usually not case-sensitive.
As concerns the last two examples, notice that the result of the search is different when you remove the parentheses of the first search key list.
Search-keys may request the value to search for:
<date> is a string that must be formatted as follows: date-day+"-"+date-month+"-"+date-year where date-day indicates the number of the day of the month (max. 2 characters), date-month indicates the name of the month (Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Dec) and date-year indicates the year (4 characters). Example: searchCriteria = SENTBEFORE 1-Feb-2000 (a date does not usually need to be quoted since it does not contain any special characters)
<string> may contain any character and must be quoted. If the string does not contain any special characters, like the space character for instance, it does not need to be quoted. Quoting such strings will ensure that your string value will be correctly interpreted. Example: searchCriteria = FROM "SMITH" Note: For all search keys that use strings, a message matches the key if the string is a substring of the field. Matching is not case-sensitive.
<field-name> is the name of a header field. Example: searchCriteria = HEADER CONTENT-TYPE "MIXED"
<flag> may accept one or several keywords (including standard flags), separated by spaces. Example: searchCriteria = KEYWORD \Flagged \Draft
A comma delimits individual numbers; a colon delimits between two numbers inclusive. Examples: searchCriteria = 1:5 ANSWERED search in message selection from message sequence number 1 to 5 for messages which have the \Answered flag set. searchCriteria= 2,4 ANSWERED search in the message selection (message numbers 2 and 4) for messages which have the \Answered flag set. ALL: All messages in the mailbox. ANSWERED: Messages with the \Answered flag set. UNANSWERED: Messages that do not have the \Answered flag set. DELETED: Messages with the \Deleted flag set. UNDELETED: Messages that do not have the \Deleted flag set. DRAFT: Messages with the \Draft flag set. UNDRAFT: Messages that do not have the \Draft flag set. FLAGGED: Messages with the \Flagged flag set. UNFLAGGED: Messages that do not have the \Flagged flag set. RECENT: Messages that have the \Recent flag set. OLD: Messages that do not have the \Recent flag set. SEEN: Messages that have the \Seen flag set. UNSEEN: Messages that do not have the \Seen flag set. NEW: Messages that have the \Recent flag set but not the \Seen flag. This is functionally equivalent to “(RECENT UNSEEN)”. KEYWORD <flag>: Messages with the specified keyword set. UNKEYWORD <flag>: Messages that do not have the specified keyword set. BEFORE <date>: Messages whose internal date is earlier than the specified date. ON <date>: Messages whose internal date is within the specified date. SINCE <date>: Messages whose internal date is within or later than the specified date. SENTBEFORE <date>: Messages whose Date header is earlier than the specified date. SENTON <date>: Messages whose Date header is within the specified date. SENTSINCE <date>: Messages whose Date header is within or later than the specified date. TO <string>: Messages that contain the specified string in the TO header. FROM <string>: Messages that contain the specified string in the FROM header. CC <string>: Messages that contain the specified string in the CC header. BCC <string>: Messages that contain the specified string in the BCC header. SUBJECT <string>: Messages that contain the specified string in the Subject header. BODY <string>: Messages that contain the specified string in the message body. TEXT <string>: Messages that contain the specified string in the header or in the message body. HEADER <field-name> <string>: Messages that have a header with the specified field-name and that contain the specified string in the field-body. UID <message UID>: Messages with unique identifiers corresponding to the specified unique identifier set. LARGER <n>: Messages with a size larger than the specified number of bytes. SMALLER <n>: Messages with a size smaller than the specified number of bytes. NOT <search-key>: Messages that do not match the specified search key. OR <search-key1> <search-key2>: Messages that match either search key. |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: 4D Internet Commands 6.8.1 SEE ALSO |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||