Share this page

# mapi_read_next_mail

MS Exchange Server Functions (mapi)

Reads the next mail in the mailbox.

    int mapi_read_next_mail( char *transaction, char *Show, [char *options,] LAST );

transaction | A transaction name for this step in quotes. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
Show | The show option of the mail message in the format: `"Show=id | heading | summary | all` (default)`"`
options | The following options are available: Peek - If set to true, the function just peeks at the message without reading it. The message will not be marked as read. Use the following format: `"Peek=`true`|` false(default)`"` Type - The type of mail message. For example, IPM.Note indicates a sticky note. The default is a simple mail message. Use the following format: `"Type=`mail_type`"` Save - save the body of the current message to the "Content" property. See below. Use the format: `"Save=body"` MessageID - Sets which message to read next`. Use the format`: "`MessageId =<Message Id>"`
LAST | A marker indicating the end of the argument list.

The mapi_read_next_mail function reads a mail message using the MAPI server. Using the Peek option, you can control whether or not to mark the mail as read or unread.

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

The "Save=body" option saves the body of the current message to the "Content" property. This property can then be retrieved with the mapi_get_property_sz or mapi_get_property_sz_ex functions.

## 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 mapi_read_next_mail peeks at a sticky note message.

Copy code

    // Reset mail to beginning of mailbox

        mapi_set_property_sz("Message ID", "");

        do {
            // Peek at next mail (don't mark it as read)
            rc = mapi_read_next_mail("NextMail",
            "Show=all",
           "Peek=True",
           "Type=IPM.Note",
           LAST );
       } while (rc == LR_PASS);

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: