Share this page

# imap_fetch

Internet Messaging Functions (IMAP)

Retrieves data associated with mailbox messages.

    int imap_fetch( char *transaction, char *mode, char *message, ENDITEM, LAST );

transaction | A transaction name for this step in quotes. To avoid creating a transaction for this step, use a null string, "".
mode | The fetch mode in the following format: `"Mode=`mode`"`
message | The messages whose data you want to fetch and the data. The data can be any information associated with the message, such as UID, FLAGS, RFC822.SIZE, RFC822.HEADER, etc. `"Fetch=`begin_msg:end_msg (data)`"`
ENDITEM | A marker indicating the end of the data item list. Repeat the option and ENDITEM arguments for each set of data that you fetch.
LAST | A marker indicating the end of the argument list.

The imap_fetch function retrieves data associated with mailbox messages, for a specific session. You can request the value of any message data including flags, headers, and message IDs.

This function is for use with global sessions. For multiple sessions, use the imap_fetch_ex function, which allows you to specify a session identifier.

## Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

## Parameterization

All arguments of this function of the type char, can be parameterized with standard parameterization.

## Example

In the following example, the imap_fetch function fetches information from messages 1 through 10—Message ID, flags, and the RFC822 size and header of the message.

Copy code

    imap_fetch("FetchMessages",
            "Mode=",
            "Fetch=1:10 (UID FLAGS RFC822.SIZE RFC822.HEADER)", ENDITEM,
            LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: