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 Summary
Modifier and TypeMethodDescriptionjakarta.mail.internet.InternetAddressString[]getHtml()jakarta.mail.MessageThe method returns a copy of the underlyingMessage.getText()voidwriteTo(OutputStream outputStream) Output the underlying message as an RFC 822 format stream.
-
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
- Parameters:
name- the name of the header- Returns:
- array of decoded headers for the given name
- Since:
- 10.0.142
-
writeTo
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 streamjakarta.mail.MessagingException- if an error occurs fetching the data to be written
-
getMessageCopy
The method returns a copy of the underlyingMessage. 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 streamjakarta.mail.MessagingException- if an error occurs fetching the data to be written- Since:
- 12.33
-