Share this page

# imap_copy_ex

Internet Messaging Functions (IMAP)

Copies messages to a mailbox for a specific session.

    int imap_copy_ex( IMAP *ppimap, char *transaction, char *message, char *mailbox, ENDITEM, LAST );

ppimap | A session identifier.
transaction | A transaction name for this step in quotes. To avoid creating a transaction for this step, use a null string, "".
message | The message number or range of messages to copy. Use the following format: `"Message=`message_number | begin`:`end `"`
mailbox | The name of the destination mailbox in the following format: `"MAILBOX=`mailbox_name`"`
ENDITEM | A marker indicating the end of the message items. Repeat the message, mailbox and ENDITEM arguments for each set of messages you need to copy.
LAST | A marker indicating the end of the argument list.

The imap_copy_ex function copies messages from the current mailbox into another mailbox. You can specify a single message or a range of messages to copy. If the destination mailbox does not exist, the server returns an error.

This function is for use with multiple sessions. For global sessions, use the imap_copy function, which leaves out the 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_copy_ex function copies several messages from the current mailbox. It copies messages 2 through 4 to the Meeting mailbox, and message 10 to the Archived mailbox.

        imap_copy_ex(&imap1, "CopyToFolders",
            "Message=2:4", "ToMailbox=Meeting", ENDITEM,
            "Message=10", "ToMailbox=Archived", ENDITEM,
            LAST );

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