Delete Messages

ImapClient can be used to delete messages from the server. Messages can be deleted using a message’s sequence number of message id. The ImapClient’s deleteMessage is used to delete messages using any of these input parameters.

Delete Messages by Sequence Number

Delete Messages using Message Id

Delete Set of Messages using Message UIDs

In order to delete a set of messages using the messages’ unique ids (UIDs), the API’s deleteMessagesByUids can be used as shown in the following code sample.