Interface MailMessage

All Known Subinterfaces:
AgentDraftMessage, AgentMessage, BacklogMessage, DeliveryFailureMessage, ExternalReplyMessage, IncomingMessage, OutgoingMessage, PreSendAgentMessage, PreSendMessage, QuickCaseMessage, SentMessage, TemplateMessage

public interface MailMessage

Represents an object, that has a jakarta.mail.Message

Since:
10.0.16
  • Method Details

    • getMessageId

      String getMessageId()
      Returns:
      the message id as string
      Since:
      10.0.16
    • getFromAddress

      jakarta.mail.internet.InternetAddress getFromAddress()
      Returns:
      the sender address of the message
      Since:
      10.0.42
    • getSubject

      String getSubject()
      Returns:
      the subject as string
      Since:
      10.0.16
    • getText

      String getText()
      Returns:
      the plain text of the message as string
      Since:
      10.0.16
    • getHtml

      String getHtml()
      Returns:
      the html text of the message as string
      Since:
      10.0.16
    • getAttachments

      Set<MessageAttachmentDataSource> getAttachments()
      Returns:
      a Set of all attachments of the message
      Since:
      11.0
    • getHeader

      String[] getHeader(String name)
      Parameters:
      name - the name of the header
      Returns:
      array of decoded headers for the given name
      Since:
      10.0.142
    • writeTo

      void writeTo(OutputStream outputStream) throws IOException, jakarta.mail.MessagingException
      Output the underlying message as an RFC 822 format stream. Example code to obtain a MimeMessage instance: try { java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(16384); mailMessage.writeTo(out); jakarta.mail.internet.MimeMessage m = new jakarta.mail.internet.MimeMessage((jakarta.mail.Session)null, new java.io.ByteArrayInputStream(out.toByteArray())); // do something with the MimeMessage; } catch (java.io.IOException | jakarta.mail.MessagingException e) {}
      Parameters:
      outputStream - the OutputStream to write the message data
      Throws:
      IOException - if an error occurs writing to the stream
      jakarta.mail.MessagingException - if an error occurs fetching the data to be written
    • getMessageCopy

      jakarta.mail.Message getMessageCopy() throws IOException, jakarta.mail.MessagingException
      The method returns a copy of the underlying Message. Please note that frequent usage of this method may impact the heap memory consumption and general system performance.
      Returns:
      a copy of the underlying Message
      Throws:
      IOException - if an error occurs writing to the stream
      jakarta.mail.MessagingException - if an error occurs fetching the data to be written
      Since:
      12.33