ImapDeleteMessage Function  
 
INT WINAPI ImapDeleteMessage(
  HCLIENT hClient,  
  UINT nMessageId  
);

The ImapDeleteMessage function marks the specified message for deletion from the current mailbox.

Parameters

hClient
Handle to the client session.
nMessage
Number of message to delete from the server. This value must be greater than zero. The first message in the mailbox is message number one.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is IMAP_ERROR. To get extended error information, call ImapGetLastError.

Remarks

This function only marks the message for deletion. The message is not actually deleted until the mailbox is expunged or another mailbox is selected. This function will return an error if the current mailbox is in read-only mode, such as if it was selected using the ImapExamineMailbox function.

It is important to note that unlike the POP3 protocol, a message that is marked for deletion is still accessible on the IMAP server until the mailbox is expunged. This means, for example, that a deleted message can still be retrieved using the ImapGetMessage function.

To determine if a message has been marked for deletion, use the ImapGetMessageFlags function and check if the IMAP_FLAG_DELETED bit flag has been set. To list all of the deleted messages in the current mailbox, use the ImapGetDeletedMessages function.

To remove the deletion flag from the message, use the ImapUndeleteMessage function. To prevent all messages in the current mailbox from being expunged, use the ImapReselectMailbox function to reset the current mailbox state.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmapav7.lib.

See Also

ImapGetDeletedMessages, ImapGetMessage, ImapGetMessageCount, ImapGetMessageFlags, ImapReselectMailbox, ImapUndeleteMessage, ImapUnselectMailbox