public interface EmailMessageBuilder
JavaMailSessionBuilderFactory.INSTANCE| Modifier and Type | Method and Description |
|---|---|
EmailMessageBuilder |
address(EmailMessageAddressType addressType,
EmailMessageAddress nullableAddress)
Sets an email address.
|
LinkedHashSet<EmailMessageAddress> |
addressSet(EmailMessageAddressListType addressListType)
Access an address set.
|
ArrayList<EmailMessageAttachment> |
attachmentList()
Optional: Directly access list of attachments.
|
EmailMessageBuilder |
body(TextMimeSubType textMimeSubType,
String text)
Required: Sets the email body.
|
javax.mail.internet.MimeMessage |
build()
Constructs a new instance of
MimeMessage. |
EmailMessageBinaryAttachmentBuilder |
builderForBinaryAttachment()
Optional: Creates a builder for binary attachments.
|
EmailMessageTextAttachmentBuilder |
builderForTextAttachment()
Optional: Creates a builder for text attachments.
|
com.google.common.collect.LinkedHashMultimap<String,String> |
headers()
Optional: Access custom headers multi-map.
|
JavaMailSession |
javaMailSession() |
EmailMessageBuilder |
subject(String subject)
Required: Sets the email subject.
|
JavaMailSession javaMailSession()
Session objectEmailMessageBuilder address(EmailMessageAddressType addressType, @Nullable EmailMessageAddress nullableAddress)
Required: EmailMessageAddressType.FROM
Optional: EmailMessageAddressType.SENDER
nullableAddress - use null to clear the addressLinkedHashSet<EmailMessageAddress> addressSet(EmailMessageAddressListType addressListType)
Important: An email message must have at least one recipient in To:, Cc:, or Bcc: lists.
Why return LinkedHashSet? It is an ordered unique collection of addresses.
com.google.common.collect.LinkedHashMultimap<String,String> headers()
EmailMessageBuilder subject(String subject)
subject - must not be empty or all whitespaceIllegalArgumentException - if subject is empty or all whitespaceEmailMessageBuilder body(TextMimeSubType textMimeSubType, String text)
textMimeSubType - initial release will only support plain text or HTML email bodytext - must not be empty or all whitespaceIllegalArgumentException - if text is empty or all whitespaceEmailMessageTextAttachmentBuilder builderForTextAttachment()
For binary attachments, see: builderForBinaryAttachment().
builderForBinaryAttachment(),
attachmentList()EmailMessageBinaryAttachmentBuilder builderForBinaryAttachment()
For text attachments, see: builderForTextAttachment().
builderForTextAttachment(),
attachmentList()ArrayList<EmailMessageAttachment> attachmentList()
javax.mail.internet.MimeMessage build()
throws Exception
MimeMessage. Throws if any required values are unset.Exception - if any required value is missing
MimeMessage throws on constructionJavaMailSessionBuilder,
JavaMailSession.session(),
JavaMailSession.sendMessage(Message)Copyright © 2013–2020. All rights reserved.