Interface MailEvent

All Superinterfaces:
Event
All Known Implementing Classes:
MailEventImpl

public interface MailEvent extends Event
An event that is produced to indicate the presence of a mail. This may be a mail that has been received or that has been stored to a special folder.
These events are usually not serialisable.

To allow for event handling chains for the very same event, some issues need to be respected when handling a MailEvent:

  • The message must not be changed (for instance change the recipients) unless the event handler is consuming and indicates this consumption when handling the event.
  • Method Details

    • getAllRecipients

      String[] getAllRecipients()
      Gets the recipients (mail addresses) of the mail that caused this event. In case there are no recipients (yet), an emtpy array will be returned.
      Returns:
      The recipients (mail addresses) of the mail that caused this event.
    • getSenders

      String[] getSenders()
      Gets the senders (mail addresses) of the mail that caused this event. In case there are no senders (yet), an emtpy array will be returned.
      Returns:
      The senders (mail addresses) of the mail that caused this event.
    • getSubject

      String getSubject()
      Gets the subject of the mail that caused this event. In case there is no subject (yet), null will be returned.
      Returns:
      The subject of the mail that caused this event.
    • getReceivedDate

      Date getReceivedDate()
      Gets the date the mail that caused this event has been received. In case this mail has not been received (for instance it is a draft), null will be returned.
      Returns:
      The date the mail that caused this event has been received.
    • getSentDate

      Date getSentDate()
      Gets the date the mail that caused this event has been sent. In case this mail has not been sent (for instance it is a draft), null will be returned.
      Returns:
      The date the mail that caused this event has been sent.
    • getStringContent

      String getStringContent()
      Gets the string content of the mail that caused this event. In case there is no string content (yet), null will be returned.
      Returns:
      The string content of the mail that caused this event.
    • getMessage

      jakarta.mail.Message getMessage()
      Gets the message (mail) that caused this event.
      Important: Only change this message if you consume this event!
      Returns:
      The message (mail) that caused this event.