Share this page

# imap_expunge_ex

Internet Messaging Functions (IMAP)

Deletes messages from a mailbox for a specific session.

    int imap_expunge_ex( IMAP *ppimap, char *transaction, char *method, [char *message,] 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, "".
method | The deletion method: DeleteMarkedMail or DeleteSpecificMail
message | The message number or range of messages to delete. This only applies for the DeleteSpecificMail method. Use the following format: `"Message=`message_number | begin`:`end `"`
LAST | A marker indicating the end of the argument list.

The imap_expunge_ex function permanently deletes messages on the IMAP server for a specific session.

This function is for use with multiple sessions. For global sessions, use the imap_expunge 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_expunge_ex function deletes messages 15, 17, and 20 through 40.

Copy code

        //Delete all messages marked with the /Delete flag
        imap_expunge_ex(&imap1,"DeleteMarkedMail",
                LAST );
        //Delete specific messages
        imap_expunge_ex(*imap1,"DeleteSpecificMail",
                "Message=15",
                "Message=17",
                "Message=20:40",
                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: