Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 24.0

Otp

You can delete messages through calls to methods of the DeleteMessages class:

Figure: The DeleteMessage Class

JavaMail_DeleteMessagesImage Modified

You can:

  • delete specific messages from the inbox folder by message id
  • delete specific messages from arbitrary folders by message id
  • delete messages matching retrieval constraints (time window, subject line, unread, etc)

Deleting a Message from the Inbox by its ID

You can delete a message with a known id from the inbox by calling the deleteMessageById method:

JavaMail_DeleteMessages_deleteMessageByIdImage Modified

Parameters of method deleteMessageById in detail:

NameTypeDirectionRemarks
connectionMailConnectionIn
Multiexcerpt include
MultiExcerptNameconnection
nopaneltrue
PageWithExcerptReading Messages
idStringInId of the message to be deleted.
returnBooleanReturnTrue, if the message was found and deleted. False otherwise.

Deleting Multiple Messages from the Inbox by their IDs

Analogous todeleteMessageById, you can delete multiple messages by their ids from the inbox by calling the deleteMessagesById method.

Parameters of method deleteMessagesById in detail:

NameTypeDirectionRemarks
connectionMailConnectionIn
Multiexcerpt include
MultiExcerptNameconnection
nopaneltrue
PageWithExcerptReading Messages
idArray of StringInList of ids of the messages to be deleted.
returnBooleanReturnTrue, if the action has been successful. False otherwise.

Deleting a Message from an Arbitrary Folder by its ID

You can delete a message from an arbitrary folder by its ID by calling the deleteMessageByFolderAndId method:

JavaMail_DeleteMessages_deleteMessageByFolderAndIdImage Modified

Parameters of method deleteMessageByFolderAndId in detail:

NameTypeDirectionRemarks
connectionMailConnectionIn
Multiexcerpt include
MultiExcerptNameconnection
nopaneltrue
PageWithExcerptReading Messages
folderStringInFolder in which the message is located.
idStringInId of the message.
returnBooleanReturnTrue, if the message was found and deleted. False otherwise.

Deleting Specific Messages Using Retrieval Constraints

You can specify which messages to delete by providing a constraints object to the deleteMessagesWithConstraints method:

Image Modified

Parameters of method deleteMessageWithConstraint in detail:

NameTypeDirectionRemarks
connectionMailConnectionIn
Multiexcerpt include
MultiExcerptNameconnection
nopaneltrue
PageWithExcerptReading Messages
constraintsRetrievalConstraintsInClass containing the constraints that the records to be deleted must match.
affectedMessagesIntegerReturnNumber of messages that have been deleted.
Panel
titleOn this Page:
Table of Contents