4D Internet Commands v16IMAP_MsgFetch |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D Internet Commands v16
IMAP_MsgFetch
|
IMAP_MsgFetch ( imap_ID ; msgNum ; msgDataItem ; msgDataItemValue ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
imap_ID | Longint |
![]() |
Reference to an IMAP login | |||||
msgNum | Longint |
![]() |
Message number | |||||
msgDataItem | Text |
![]() |
Data item(s) to retrieve | |||||
msgDataItemValue | Text |
![]() |
Data item(s) value | |||||
Function result | Integer |
![]() |
Error code | |||||
The IMAP_MsgFetch command allows the user to request one or several basic data items for the specified message without downloading the message.
imap_ID is a long integer reference to an open connection created with IMAP_Login.
msgNum is a long integer value indicating the message to be checked. This value represents the position of a message within the current list of messages. You cannot rely on the msgNum remaining the same for a specific e-mail item from session to session.
msgDataItem is a text variable that indicates one or several data items you want to retrieve. In the case of several data items, a space character must separate each of them. There are two kinds of data items:
For more information on data items, see the “Basic data items” and “Macro data items” paragraphs below.
msgDataItemValue is a text variable that can return either a single DataItem/DataItemValue pair or a list of DataItem/DataItemValue pairs depending on the msgDataItem parameter value.
msgDataItemValue may contain a parenthesized list, a quoted string or a single string depending on the msgDataItem parameter.
Note: Quotes are generally used when the string value includes special characters, such as a space or parentheses. As such, when you parse the resulting string of the IMAP_Fetch command, quote characters are taken into consideration when processing the string content.
Example:
msgDataItem:="INTERNALDATE"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItem returns INTERNALDATE "17-Jul-2001 15:45:37 +0200"
Example:
msgDataItem:="FLAGS"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItem returns FLAGS () if there is no flag set for the specified message.
msgDataItem returns FLAGS (\Seen \Answered) if \Seen and \Answered flags are set for the specified message.
Example:
msgDataItem:="RFC822.SIZE"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItem returns RFC822.SIZE 99599
msgDataItem:="ENVELOPE"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItem returns ENVELOPE ("Tue, 17 Jul 2001 17:26:34 +0200" "Test" (("RSmith" NIL "RSmith" "test")) (("RSmith" NIL "RSmith" "test")) (("RSmith" NIL "RSmith" "test")) (("RSmith" NIL "RSmith" "test")) () () "" "<ee6b33a.-1@Mail.x6foadRIbnm>")
Date: | "Tue, 17 Jul 2001 17:26:34 +0200" | date header |
Subject: | "Test" | subject header |
From: | (("RSmith" NIL "RSmith" "test")) | address structures |
Sender: | (("RSmith" NIL "RSmith" "test")) | address structures |
reply-to: | (("RSmith" NIL "RSmith" "test")) | address structures |
to: | (("RSmith" NIL "RSmith" "test")) | address structures |
cc: | () | Cc header not used |
bcc: | () | Bcc header not used |
in-reply-to: | "" | In-reply-to header |
message-id: | "<ee6b33a.-1@Mail.x6foadRIbnm>" | message-id header |
The from, sender, reply-to, to, cc and bcc fields are parenthesized lists of address structures. An address structure is a parenthesized list that describes an electronic mail address. The fields of an address structure are in the following order: personal name, [SMTP] at-domain-list (source route), mailbox name and host name. For instance, (("RSmith" NIL "RSmith" "test")).
(From [RFC-822]) Group syntax is indicated by a special form of address structure where the host name field is NIL. If the mailbox name field is also NIL, this is an end-of-group marker (semi-colon in RFC 822 syntax). If the mailbox name field is non-NIL, this is the start-of-group marker and the mailbox name field holds the group name phrase.
A field of an envelope or address structure that is not applicable is presented as NIL. Note that the server MUST default the reply-to and sender fields from the “from” field; the client is not expected to know how to do this.
msgDataItem:="BODY"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItem returns BODY ("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "8BIT" 8 1)
body type | A string giving the content media type name (Content-type: media type e.g. TEXT) |
body subtype | A string giving the content subtype name (Content-type: subtype e.g. PLAIN) |
body parameter | A parenthesized list of attribute/value pairs |
parenthesized list | [e.g. ("CHARSET" "US-ASCII" "NAME" "cc.diff") where "US-ASCII" is the value of "CHARSET" and "cc.diff" is the value of "NAME". |
body id | A string giving the content id (allows one body to make a reference to another one). Accordingly, bodies may be labeled using the "Content-ID" header field. The Content-ID value has special semantics in the case of a multipart/alternative media type. This is explained in the section of RFC 2046 dealing with multipart/alternative cases. |
body description | A string giving the content description |
body encoding | A string giving the content transfer encoding (Content-Transfer-Encoding) |
body size | A number giving the size of the body in bytes. Note that this is the size during transfer encoding and not the resulting size after decoding. |
body MD5 | A string giving the body MD5 value as defined in [MD5] |
body disposition | A parenthesized list consisting of a disposition type string followed by a parenthesized list of disposition attribute/value pairs as defined in [DISPOSITION] |
body language | A string or parenthesized list giving the body language value as defined in [LANGUAGE-TAGS] |
body parameter | A parenthesized list of attribute/value pairs parenthesized list |
body disposition | A parenthesized list consisting of a disposition type string followed by a parenthesized list of disposition attribute/value pairsas defined in [DISPOSITION] |
body language | A string or parenthesized list giving the body language value as defined in [LANGUAGE-TAGS] |
msgDataItem:="UID"
$Err:=IMAP_MsgFetch(imap_ID;1;msgDataItem;msgDataItemValue)
msgDataItemValue returns UID 250000186
To retrieve a longint value:
C_LONGINT(vLongint)
VLongint:=Num("250000186")
$Err:=IMAP_MsgFetch(imap_ID;msgNum;"FAST";msgDataItemValue)
msgDataItemValue returns "FLAGS (\Seen \Answered) INTERNALDATE "17-Jul-2001 15:45:37 +0200" RFC822.SIZE 99599"
Product: 4D Internet Commands
Theme: IC IMAP Review Mail
Number:
88868
Created: 4D Internet Commands 6.8.1
4D Internet Commands ( 4D Internet Commands v16)