Share this page

# imap_expunge

Internet Messaging Functions (IMAP)

Deletes messages from a mailbox.

    int imap_expunge( char *transaction, char *method, [char *message,] LAST );

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 function deletes messages on the IMAP server using the specified function.

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

Copy code

        //Delete all messages marked with the /Delete flag

        imap_expunge("DeleteMarkedMail",
                LAST );

        //Delete specific messages

        imap_expunge("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: