public final class MessageBuilder extends Object
Message instance.| Modifier and Type | Method and Description |
|---|---|
MessageBuilder |
bcc(List<String> bccAddresses)
Adds the "bcc" addresses to the
Message that is being built. |
javax.mail.internet.MimeMessage |
build()
Builds the
Message with all the data provided. |
MessageBuilder |
cc(List<String> ccAddresses)
Adds the "cc" addresses to the
Message that is being built. |
MessageBuilder |
fromAddresses(List<String> fromAddresses)
Adds the from addresses to the
Message that is being built. |
MessageBuilder |
fromAddresses(String from)
Adds a single from address to the
Message that is being built. |
static MessageBuilder |
newMessage(javax.mail.Session session)
Creates a new
MessageBuilder instance for the specified session. |
MessageBuilder |
replyTo(List<String> replyAddresses)
Adds the reply to addresses of the
Message that is being built. |
MessageBuilder |
to(List<String> toAddresses)
Adds the "to" (primary) addresses to the
Message that is being built. |
MessageBuilder |
withAttachments(List<EmailAttachment> attachments)
Adds attachments represented as
EmailAttachments to the Message that is being built. |
MessageBuilder |
withAttachments(Map<String,DataHandler> attachments)
|
MessageBuilder |
withBody(String content)
Adds the text content the
Message that is being built. |
MessageBuilder |
withBody(String content,
org.mule.runtime.api.metadata.MediaType contentType,
String charset)
Adds the text content the
Message that is being built. |
MessageBuilder |
withHeaders(Map<String,String> headers)
Adds custom headers to the
Message that is being built. |
MessageBuilder |
withSentDate(Date date)
Adds the sent date to the
Message that is being built. |
MessageBuilder |
withSubject(String subject)
Adds the subject to the
Message that is being built. |
public static MessageBuilder newMessage(javax.mail.Session session)
MessageBuilder instance for the specified session.session - the Session for which the message is going to be createdMessageBuilder instance.public MessageBuilder withSubject(String subject) throws javax.mail.MessagingException
Message that is being built.subject - the subject of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder fromAddresses(List<String> fromAddresses) throws javax.mail.MessagingException
Message that is being built.fromAddresses - the from addresses of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder fromAddresses(String from) throws javax.mail.MessagingException
Message that is being built.from - the from address of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder to(List<String> toAddresses) throws javax.mail.MessagingException
Message that is being built.toAddresses - the primary addresses of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder bcc(List<String> bccAddresses) throws javax.mail.MessagingException
Message that is being built.bccAddresses - the blind carbon copy addresses of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder cc(List<String> ccAddresses) throws javax.mail.MessagingException
Message that is being built.ccAddresses - the carbon copy addresses of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder withHeaders(Map<String,String> headers) throws javax.mail.MessagingException
Message that is being built.headers - the custom headers of the email.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder withAttachments(List<EmailAttachment> attachments)
EmailAttachments to the Message that is being built.attachments - the attachments that are going to be added to the email.MessageBuilderpublic MessageBuilder withAttachments(Map<String,DataHandler> attachments)
attachments - the attachments that are going to be added to the email.MessageBuilderpublic MessageBuilder withSentDate(Date date) throws javax.mail.MessagingException
Message that is being built.date - the date in which the email was sent.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder withBody(String content, org.mule.runtime.api.metadata.MediaType contentType, String charset) throws javax.mail.MessagingException
Message that is being built.content - the text content of the email. If null is received, StringUtils.EMPTY will be used instead.contentType - the contentType of the content of the email. One of "text/plain" or "text/html" expected.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder withBody(String content) throws javax.mail.MessagingException
Message that is being built. The contentType of this content will default to "text/plain".content - the text content of the email. If null is received, StringUtils.EMPTY will be used instead.MessageBuilderjavax.mail.MessagingExceptionpublic MessageBuilder replyTo(List<String> replyAddresses) throws javax.mail.MessagingException
Message that is being built.replyAddresses - the reply to addresses of the email.MessageBuilderjavax.mail.MessagingExceptionpublic javax.mail.internet.MimeMessage build()
throws javax.mail.MessagingException
Message with all the data provided.MimeMessage instance.javax.mail.MessagingExceptionCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.