public interface EmailPopulatingBuilder
Email
instances. An instance of this builder can only be obtained through one of the builder
starters on EmailStartingBuilder
.
Note: To start creating a new Email, you use EmailBuilder
directly instead.
Note: For some reason, JavaDoc is not able to parse all @link
directives used in this class' documentation. I have no idea why, if you can figure
it out, please let me know!
Modifier and Type | Field and Description |
---|---|
static Pattern |
IMG_SRC_PATTERN
Regular Expression to find all
<img src="..."> entries in an HTML document.It needs to cater for various things, like more whitespaces including newlines on any
place, HTML is not case-sensitive and there can be arbitrary text between "IMG" and "SRC" like IDs and other things. |
Modifier and Type | Method and Description |
---|---|
EmailPopulatingBuilder |
allowingEmbeddedImageOutsideBaseClassPath(boolean allowEmbeddedImageOutsideBaseClassPath)
Dictates whether sources will be resolved for embedded images when they are not nested under the baseClassPath (if baseClassPath is set).
|
EmailPopulatingBuilder |
allowingEmbeddedImageOutsideBaseDir(boolean allowEmbeddedImageOutsideBaseDir)
Dictates whether files will be resolved for embedded images when they are not nested under the baseDir (if baseDir is set).
|
EmailPopulatingBuilder |
allowingEmbeddedImageOutsideBaseUrl(boolean allowEmbeddedImageOutsideBaseUrl)
Dictates whether url's will be resolved for embedded images when they are not nested under the baseUrl (if baseUrl is set).
|
EmailPopulatingBuilder |
appendText(@NotNull File textFile)
Delegates to
appendText(String) . |
EmailPopulatingBuilder |
appendText(@NotNull String text)
Appends text to the current plain text body (or starts it if plain text body is missing).
|
EmailPopulatingBuilder |
appendTextHTML(@NotNull File textHTMLFile)
Delegates to
appendTextHTML(String) . |
EmailPopulatingBuilder |
appendTextHTML(@NotNull String textHTML)
Appends HTML text to the current HTML text body (or starts it if HTML text body is missing).
|
EmailPopulatingBuilder |
bcc(@NotNull Collection<Recipient> recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with fixedRecipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bcc(@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bcc(Recipient... recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with fixedRecipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bcc(@NotNull String oneOrMoreAddresses)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bcc(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Alias for
bccWithFixedName(String, Collection) . |
EmailPopulatingBuilder |
bcc(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
|
EmailPopulatingBuilder |
bcc(@Nullable String name,
jakarta.mail.internet.InternetAddress address)
|
EmailPopulatingBuilder |
bcc(@Nullable String name,
String... oneOrMoreAddressesEach)
Alias for
bccWithFixedName(String, String...) . |
EmailPopulatingBuilder |
bcc(@Nullable String name,
String oneOrMoreAddresses)
Delegates to
withRecipients(String, boolean, Collection, Message.RecipientType) , with recipientType= Message.RecipientType#BCC
and fixedName=true assigning or overwriting existing names with the provided name. |
EmailPopulatingBuilder |
bccAddresses(@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bccAddresses(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
|
EmailPopulatingBuilder |
bccAddressesWithDefaultName(@NotNull String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccAddressesWithDefaultName(@NotNull String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccAddressesWithFixedName(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccAddressesWithFixedName(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccMultiple(jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bccMultiple(String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bccMultipleAddresses(@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC and empty default name. |
EmailPopulatingBuilder |
bccWithDefaultName(@NotNull String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccWithDefaultName(@NotNull String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccWithFixedName(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
EmailPopulatingBuilder |
bccWithFixedName(@Nullable String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#BCC . |
Email |
buildEmail()
Validated DKIM values and then delegates to
Email.Email(EmailPopulatingBuilder) with this as argument. |
Email |
buildEmailCompletedWithDefaultsAndOverrides()
Delegates to
buildEmailCompletedWithDefaultsAndOverrides(EmailGovernance) with an empty default email governance, which
will still apply default config (System) properties (files). |
Email |
buildEmailCompletedWithDefaultsAndOverrides(@NotNull EmailGovernance emailGovernance)
Like
buildEmail() , but returning the final email version right away. |
EmailPopulatingBuilder |
cc(@NotNull Collection<Recipient> recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
cc(@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
cc(Recipient... recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
cc(@NotNull String oneOrMoreAddresses)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
cc(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Alias for
ccWithFixedName(String, Collection) . |
EmailPopulatingBuilder |
cc(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
|
EmailPopulatingBuilder |
cc(@Nullable String name,
jakarta.mail.internet.InternetAddress address)
|
EmailPopulatingBuilder |
cc(@Nullable String name,
String... oneOrMoreAddressesEach)
Alias for
ccWithFixedName(String, String...) . |
EmailPopulatingBuilder |
cc(@Nullable String name,
String oneOrMoreAddresses)
Delegates to
withRecipients(String, boolean, Collection, Message.RecipientType) , with recipientType= Message.RecipientType#CC
and fixedName=true assigning or overwriting existing names with the provided name. |
EmailPopulatingBuilder |
ccAddresses(@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
ccAddresses(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Alias for
ccAddressesWithFixedName(String, Collection) . |
EmailPopulatingBuilder |
ccAddressesWithDefaultName(@NotNull String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccAddressesWithDefaultName(@NotNull String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccAddressesWithFixedName(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccAddressesWithFixedName(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccMultiple(jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
ccMultiple(String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
ccMultipleAddresses(@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC and empty default name. |
EmailPopulatingBuilder |
ccWithDefaultName(@NotNull String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccWithDefaultName(@NotNull String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccWithFixedName(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
ccWithFixedName(@Nullable String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#CC . |
EmailPopulatingBuilder |
clearAttachments()
Resets attachments to empty.
|
EmailPopulatingBuilder |
clearBounceTo()
Resets bounceToRecipient to empty.
|
EmailPopulatingBuilder |
clearCalendarText()
Resets calendarText to empty.
|
EmailPopulatingBuilder |
clearContentTransferEncoding()
Resets contentTransferEncoding to
ContentTransferEncoding.QUOTED_PRINTABLE . |
EmailPopulatingBuilder |
clearDispositionNotificationTo()
Resets dispositionNotificationTo to empty.
|
EmailPopulatingBuilder |
clearDkim()
Resets all dkim properties to empty.
|
EmailPopulatingBuilder |
clearEmbeddedImageBaseClassPath()
Resets classpath base for embedded images to
null . |
EmailPopulatingBuilder |
clearEmbeddedImageBaseDir()
Resets base dir for embedded images to
null . |
EmailPopulatingBuilder |
clearEmbeddedImageBaseUrl()
Resets base URL for embedded images to
null . |
EmailPopulatingBuilder |
clearEmbeddedImages()
Resets embeddedImages to empty.
|
EmailPopulatingBuilder |
clearFromRecipient()
Resets fromRecipient to empty.
|
EmailPopulatingBuilder |
clearHeaders()
Resets headers to empty.
|
EmailPopulatingBuilder |
clearHTMLText()
Resets textHTML to empty.
|
EmailPopulatingBuilder |
clearId()
Resets id to empty.
|
EmailPopulatingBuilder |
clearOverrideReceivers()
Resets overrideReceivers to empty.
|
EmailPopulatingBuilder |
clearPlainText()
Resets text to empty.
|
EmailPopulatingBuilder |
clearRecipients()
Resets recipients to empty.
|
EmailPopulatingBuilder |
clearReplyTo()
Resets replyToRecipients to empty.
|
EmailPopulatingBuilder |
clearReturnReceiptTo()
Resets returnReceiptTo to empty.
|
EmailPopulatingBuilder |
clearSentDate()
Clears the fixed sent-date so that the current date is used again at the time of sending.
|
EmailPopulatingBuilder |
clearSmime()
For signing and encrypting this email when sending, resets all S/MIME properties to empty.
|
EmailPopulatingBuilder |
clearSMIMESignedAttachmentMergingBehavior()
When readig and converting an email, this flag makes the behavior revert to the default merging
behavior for single S/MIME signed attachments, which is that it is merged into the root message.
|
EmailPopulatingBuilder |
clearSubject()
Resets subject to empty.
|
EmailPopulatingBuilder |
dontApplyDefaultValueFor(org.simplejavamail.internal.config.EmailProperty... configProperties)
Allows you to prevent a property to be configured with default values.
|
EmailPopulatingBuilder |
dontApplyOverrideValueFor(org.simplejavamail.internal.config.EmailProperty... configProperties)
Allows you to prevent a property to be configured with override values.
|
EmailPopulatingBuilder |
embeddedImageAutoResolutionMustBeSuccesful(boolean embeddedImageAutoResolutionMustBeSuccesful)
When embedded image auto resolution is enabled, this option will make sure unresolved images sources result in an exception.
|
EmailPopulatingBuilder |
encryptWithSmime(@NotNull File pemFile,
@Nullable String keyEncapsulationAlgorithm,
@Nullable String cipherAlgorithm)
Delegates to
encryptWithSmime(SmimeEncryptionConfig) using the provided PEM file. |
EmailPopulatingBuilder |
encryptWithSmime(@NotNull SmimeEncryptionConfig smimeEncryptionConfig)
Encrypts this email with a X509 certificate according to the S/MIME spec
signature.
|
EmailPopulatingBuilder |
fixingMessageId(@Nullable String id)
Sets optional ID to a fixed value, which is otherwise generated by the underlying JavaMail framework when sending the email.
|
EmailPopulatingBuilder |
fixingSentDate(@NotNull Date sentDate)
When an email is sent it is converted to a MimeMessage at which time the sent-date is filled with the current date.
|
EmailPopulatingBuilder |
from(@NotNull jakarta.mail.internet.InternetAddress fromAddress)
Delegates to
from(Recipient) with a new Recipient wrapped around the given email address. |
EmailPopulatingBuilder |
from(@NotNull Recipient recipient)
Sets the address of the sender of this email with given
Recipient (ignoring its Message.RecipientType if provided). |
EmailPopulatingBuilder |
from(@NotNull String fromAddress)
Delegates to
from(String, String) with empty name. |
EmailPopulatingBuilder |
from(@Nullable String fixedName,
@NotNull jakarta.mail.internet.InternetAddress fromAddress)
Delegates to
from(Recipient) with a new Recipient wrapped around the given fixed name and email address. |
EmailPopulatingBuilder |
from(@Nullable String name,
@NotNull String fromAddress)
Delegates to
from(Recipient) with a new Recipient wrapped around the given name and email address. |
@NotNull List<AttachmentResource> |
getAttachments() |
@Nullable Recipient |
getBounceToRecipient() |
@Nullable CalendarMethod |
getCalendarMethod() |
@Nullable ContentTransferEncoding |
getContentTransferEncoding() |
@NotNull List<AttachmentResource> |
getDecryptedAttachments()
If the S/MIME library is loaded, this method returns a copy list of the attachments, but with any signed
attachments replaced with decrypted ones.
|
@Nullable Recipient |
getDispositionNotificationTo() |
@Nullable DkimConfig |
getDkimConfig() |
@Nullable jakarta.mail.internet.MimeMessage |
getEmailToForward() |
@NotNull List<AttachmentResource> |
getEmbeddedImages() |
@Nullable Recipient |
getFromRecipient() |
@NotNull Map<String,Collection<String>> |
getHeaders() |
@Nullable String |
getId() |
@NotNull OriginalSmimeDetails |
getOriginalSmimeDetails()
If this Email instance was the result of a conversion in which the source message was S/MIME signed / encrypted,
this field will be filled for historical purpose.
|
@NotNull List<Recipient> |
getOverrideReceivers() |
@Nullable Set<org.simplejavamail.internal.config.EmailProperty> |
getPropertiesNotToApplyDefaultValueFor() |
@Nullable Set<org.simplejavamail.internal.config.EmailProperty> |
getPropertiesNotToApplyOverrideValueFor() |
@NotNull List<Recipient> |
getRecipients() |
@NotNull List<Recipient> |
getReplyToRecipients() |
@Nullable Recipient |
getReturnReceiptTo() |
@Nullable Date |
getSentDate() |
@Nullable SmimeEncryptionConfig |
getSmimeEncryptionConfig() |
@Nullable Email |
getSmimeSignedEmail()
If the Email instance currently being built was the result of a conversion in which the source message was S/MIME
signed / encrypted, this field will contain the decrypted MimeMessage instance.
|
@Nullable SmimeSigningConfig |
getSmimeSigningConfig() |
@Nullable String |
getSubject() |
@Nullable String |
getText() |
@Nullable String |
getTextCalendar() |
@Nullable String |
getTextHTML() |
@Nullable Boolean |
getUseDispositionNotificationTo() |
@Nullable Boolean |
getUseReturnReceiptTo() |
EmailPopulatingBuilder |
ignoringDefaults(boolean ignoreDefaults)
Indicates that when the email is sent, no default values whatsoever should be applied to the email.
|
EmailPopulatingBuilder |
ignoringOverrides(boolean ignoreOverrides)
Indicates that when the email is sent, no override values whatsoever should be applied to the email.
|
boolean |
isIgnoreDefaults() |
boolean |
isIgnoreOverrides() |
boolean |
isMergeSingleSMIMESignedAttachment() |
EmailPopulatingBuilder |
notMergingSingleSMIMESignedAttachment()
When the S/MIME module is loaded, S/MIME signed / encrypted attachments are decrypted and kept in a separate list.
|
EmailPopulatingBuilder |
prependText(@NotNull File textFile)
Delegates to
prependText(String) . |
EmailPopulatingBuilder |
prependText(@NotNull String text)
Prepends text to the current plain text body (or starts it if plain text body is missing).
|
EmailPopulatingBuilder |
prependTextHTML(@NotNull File textHTMLFile)
Delegates to
prependTextHTML(String) . |
EmailPopulatingBuilder |
prependTextHTML(@NotNull String textHTML)
Prepends HTML text to the current HTML text body (or starts it if HTML text body is missing).
|
EmailPopulatingBuilder |
signWithDomainKey(byte[] dkimPrivateKey,
@NotNull String signingDomain,
@NotNull String dkimSelector,
@Nullable Set<String> excludedHeadersFromDkimDefaultSigningList)
Primes this email for signing with a DKIM domain key.
|
EmailPopulatingBuilder |
signWithDomainKey(@NotNull DkimConfig dkimConfig) |
EmailPopulatingBuilder |
signWithSmime(@NotNull File pkcs12StoreFile,
@NotNull String storePassword,
@NotNull String keyAlias,
@NotNull String keyPassword,
@Nullable String signatureAlgorithm)
Delegates to
signWithSmime(SmimeSigningConfig) . |
EmailPopulatingBuilder |
signWithSmime(@NotNull SmimeSigningConfig smimeSigningConfig)
Signs this email with an S/MIME signature, so the receiving client
can verify whether the email content was tampered with.
|
EmailPopulatingBuilder |
to(@NotNull Collection<Recipient> recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
to(@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
to(Recipient... recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
to(@NotNull String oneOrMoreAddresses)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
to(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Alias for
toWithFixedName(String, Collection) . |
EmailPopulatingBuilder |
to(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
|
EmailPopulatingBuilder |
to(@Nullable String name,
jakarta.mail.internet.InternetAddress address)
|
EmailPopulatingBuilder |
to(@Nullable String name,
String... oneOrMoreAddressesEach)
Alias for
toWithFixedName(String, String...) . |
EmailPopulatingBuilder |
to(@Nullable String name,
String oneOrMoreAddresses)
Delegates to
withRecipients(String, boolean, Collection, Message.RecipientType) , with recipientType= Message.RecipientType#TO and
fixedName=true assigning or overwriting existing names with the provided name. |
EmailPopulatingBuilder |
toAddresses(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Alias for
toAddressesWithFixedName(String, Collection) . |
EmailPopulatingBuilder |
toAddressesWithDefaultName(@NotNull String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toAddressesWithDefaultName(@NotNull String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toAddressesWithFixedName(@Nullable String name,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toAddressesWithFixedName(@Nullable String name,
jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toMultiple(@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
toMultiple(jakarta.mail.internet.InternetAddress... addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
toMultiple(String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
toMultipleAddresses(@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
Delegates to
withAddressesWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO and empty default name. |
EmailPopulatingBuilder |
toWithDefaultName(@NotNull String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toWithDefaultName(@NotNull String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithDefaultName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toWithFixedName(@Nullable String name,
@NotNull Collection<String> oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
EmailPopulatingBuilder |
toWithFixedName(@Nullable String name,
String... oneOrMoreAddressesEach)
Delegates to
withRecipientsWithFixedName(String, Collection, Message.RecipientType) with recipientType= Message.RecipientType#TO . |
@NotNull EmailPopulatingBuilder |
withAddresses(@Nullable String name,
boolean fixedName,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipient(String, String, Message.RecipientType) for each address in the provided collection. |
@NotNull EmailPopulatingBuilder |
withAddressesWithDefaultName(@Nullable String defaultName,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withAddresses(String, boolean, Collection, Message.RecipientType) , leaving existing names intact and defaulting when missing. |
@NotNull EmailPopulatingBuilder |
withAddressesWithFixedName(@Nullable String fixedName,
@NotNull Collection<jakarta.mail.internet.InternetAddress> addresses,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withAddresses(String, boolean, Collection, Message.RecipientType) , with fixedName=true
assigning or overwriting existing names with the provided name. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
byte[] data,
@NotNull String mimetype)
Delegates to
withAttachment(String, byte[], String, String, ContentTransferEncoding) with null-description and no forced content transfer encoding. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
byte[] data,
@NotNull String mimetype,
@Nullable String description)
Delegates to
withAttachment(String, byte[], String, String, ContentTransferEncoding) with no forced content transfer encoding. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
byte[] data,
@NotNull String mimetype,
@Nullable String description,
@Nullable ContentTransferEncoding contentTransferEncoding)
Delegates to
withAttachment(String, DataSource) , with a named ByteArrayDataSource created using the provided name, data and mimetype. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
@NotNull jakarta.activation.DataSource filedata)
Delegates to
withAttachment(String, DataSource, String, ContentTransferEncoding) with null-description and no forced content transfer encoding. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
@NotNull jakarta.activation.DataSource filedata,
@Nullable String description)
Delegates to
withAttachment(String, DataSource, String, ContentTransferEncoding) with no forced content transfer encoding. |
EmailPopulatingBuilder |
withAttachment(@Nullable String name,
@NotNull jakarta.activation.DataSource filedata,
@Nullable String description,
@Nullable ContentTransferEncoding contentTransferEncoding)
Adds an attachment to the email message, which will be shown in the email client as seperate files available for download or inline display if the client supports it (for example, most browsers
these days display PDF's in a popup).
|
EmailPopulatingBuilder |
withAttachments(@NotNull List<AttachmentResource> attachments)
Delegates to
withAttachment(String, DataSource) for each attachment. |
EmailPopulatingBuilder |
withBounceTo(@NotNull jakarta.mail.internet.InternetAddress bounceToAddress)
Delegates to
withBounceTo(Recipient) with a new Recipient wrapped around the given address. |
EmailPopulatingBuilder |
withBounceTo(@Nullable Recipient recipient)
Sets the bounceTo address of this email with given
Recipient (ignoring its Message.RecipientType if provided). |
EmailPopulatingBuilder |
withBounceTo(@Nullable String bounceToAddress)
Delegates to
withBounceTo(Recipient) with a new Recipient wrapped around the email address (or null if missing). |
EmailPopulatingBuilder |
withBounceTo(@Nullable String name,
@NotNull jakarta.mail.internet.InternetAddress bounceToAddress)
Delegates to
withBounceTo(Recipient) with a new Recipient wrapped around the given fixed name and address. |
EmailPopulatingBuilder |
withBounceTo(@Nullable String name,
@NotNull String bounceToAddress)
Delegates to
withBounceTo(Recipient) with a new Recipient wrapped around the given name and email address. |
EmailPopulatingBuilder |
withCalendarText(@NotNull CalendarMethod calendarMethod,
@NotNull String textCalendar)
Sets the optional calendar details that clients such as Outlook might be able to handle.
|
EmailPopulatingBuilder |
withContentTransferEncoding(@NotNull ContentTransferEncoding contentTransferEncoding)
Determines what encoding is applied to the text/html/iCalendar encoding in the MimeMessage/EML.
|
EmailPopulatingBuilder |
withDispositionNotificationTo()
Indicates that we want to use the NPM flag
dispositionNotificationTo . |
EmailPopulatingBuilder |
withDispositionNotificationTo(@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withDispositionNotificationTo(Recipient) with a new Recipient wrapped around the provided address. |
EmailPopulatingBuilder |
withDispositionNotificationTo(@NotNull Recipient recipient)
Indicates this email should use the NPM flag "Disposition-Notification-To" with the given
preconfigred
Recipient . |
EmailPopulatingBuilder |
withDispositionNotificationTo(@NotNull String address)
Delegates to
withDispositionNotificationTo(Recipient) with a new Recipient wrapped around the provided address. |
EmailPopulatingBuilder |
withDispositionNotificationTo(@Nullable String fixedName,
@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withDispositionNotificationTo(Recipient) with a new Recipient wrapped around the provided fixed name and address. |
EmailPopulatingBuilder |
withDispositionNotificationTo(@Nullable String name,
@NotNull String address)
Delegates to
withDispositionNotificationTo(Recipient) with a new Recipient wrapped around the provided name and address. |
EmailPopulatingBuilder |
withEmbeddedImage(@NotNull String name,
byte[] data,
@NotNull String mimetype)
Delegates to
withEmbeddedImage(String, DataSource) , with a named ByteArrayDataSource created using the provided name, data and
mimetype. |
EmailPopulatingBuilder |
withEmbeddedImage(@Nullable String name,
@NotNull jakarta.activation.DataSource imagedata)
Adds image data to this email that can be referred to from the email HTML body.
|
EmailPopulatingBuilder |
withEmbeddedImageAutoResolutionForClassPathResources(boolean embeddedImageAutoResolutionForClassPathResources)
Enables auto resolution of classpath datasources for embedded images.
|
EmailPopulatingBuilder |
withEmbeddedImageAutoResolutionForFiles(boolean embeddedImageAutoResolutionForFiles)
Enables auto resolution of file datasources for embedded images.
|
EmailPopulatingBuilder |
withEmbeddedImageAutoResolutionForURLs(boolean embeddedImageAutoResolutionForURLs)
Enables auto resolution of URL's for embedded images.
|
EmailPopulatingBuilder |
withEmbeddedImageBaseClassPath(@NotNull String embeddedImageBaseClassPath)
Sets the classpath base used when resolving images sources in HTML text.
|
EmailPopulatingBuilder |
withEmbeddedImageBaseDir(@NotNull String embeddedImageBaseDir)
Sets the base folder used when resolving images sources in HTML text.
|
EmailPopulatingBuilder |
withEmbeddedImageBaseUrl(@NotNull String embeddedImageBaseUrl)
Delegates to
withEmbeddedImageBaseUrl(URL) . |
EmailPopulatingBuilder |
withEmbeddedImageBaseUrl(@NotNull URL embeddedImageBaseUrl)
Sets the base URL used when resolving images sources in HTML text.
|
EmailPopulatingBuilder |
withEmbeddedImages(@NotNull List<AttachmentResource> embeddedImages)
Delegates to
withEmbeddedImage(String, DataSource) for each embedded image. |
EmailPopulatingBuilder |
withHeader(@NotNull String name,
@Nullable Object value)
Delegates to
withHeader(String, Object, boolean) with replaceHeader set to false . |
EmailPopulatingBuilder |
withHeader(@NotNull String name,
@Nullable Object value,
boolean replaceHeader)
Adds a header which will be included in the email.
|
<T> EmailPopulatingBuilder |
withHeaders(@NotNull Map<String,Collection<T>> headers)
Delegates to
withHeader(String, Object) for each header in the provided Map . |
EmailPopulatingBuilder |
withHTMLText(@NotNull File textHTMLFile)
Delegates to
withHTMLText(String) . |
EmailPopulatingBuilder |
withHTMLText(@Nullable String textHTML)
Sets the optional email message body in HTML text.
|
EmailPopulatingBuilder |
withOverrideReceivers(@NotNull List<Recipient> recipients)
When provided, Simple Java Mail will ignore all recipients set on the email and instead send to the provided recipients only (when calling
Transport.sendMessage(Message, Address[]) ). |
EmailPopulatingBuilder |
withOverrideReceivers(Recipient... recipients)
Delegates to
withOverrideReceivers(List) |
EmailPopulatingBuilder |
withPlainText(@NotNull File textFile)
Delegates to
withPlainText(String) . |
EmailPopulatingBuilder |
withPlainText(@Nullable String text)
Sets the optional email message body in plain text.
|
EmailPopulatingBuilder |
withRecipient(@NotNull Recipient recipient)
Adds a new
Recipient instance as copy of the provided recipient (copying name, address and Message.RecipientType ). |
EmailPopulatingBuilder |
withRecipient(@Nullable String name,
boolean fixedName,
@NotNull String singleAddress,
jakarta.mail.Message.RecipientType recipientType)
Adds a new
Recipient instance with the given name, address and Message.RecipientType . |
EmailPopulatingBuilder |
withRecipient(@NotNull String singleAddress,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipient(String, String, Message.RecipientType) with the name omitted. |
EmailPopulatingBuilder |
withRecipient(@Nullable String name,
@NotNull String singleAddress,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipient(String, boolean, String, Message.RecipientType) with the name omitted and fixedName = true. |
EmailPopulatingBuilder |
withRecipients(@NotNull Collection<Recipient> recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with Message.RecipientType left empty (so it will use the original values). |
@NotNull EmailPopulatingBuilder |
withRecipients(@NotNull Collection<Recipient> recipients,
jakarta.mail.Message.RecipientType fixedRecipientType)
Delegates to
withRecipient(String, String, Message.RecipientType) for each recipient in the provided collection, optionally fixing the
recipientType for all recipients to the provided type. |
EmailPopulatingBuilder |
withRecipients(Recipient... recipients)
Delegates to
withRecipients(Collection, Message.RecipientType) with Message.RecipientType left empty (so it will use the original values). |
@NotNull EmailPopulatingBuilder |
withRecipients(@Nullable String name,
boolean fixedName,
@NotNull Collection<String> oneOrMoreAddressesEach,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipient(Recipient) for each address found in not just the collection, but also in every individual address string
that is in the collection. |
@NotNull EmailPopulatingBuilder |
withRecipients(@Nullable String name,
boolean fixedName,
jakarta.mail.Message.RecipientType recipientType,
String... oneOrMoreAddressesEach)
|
@NotNull EmailPopulatingBuilder |
withRecipientsWithDefaultName(@Nullable String defaultName,
@NotNull Collection<String> oneOrMoreAddressesEach,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipients(String, boolean, Collection, Message.RecipientType) , leaving existing names intact and defaulting when missing. |
@NotNull EmailPopulatingBuilder |
withRecipientsWithDefaultName(@Nullable String name,
jakarta.mail.Message.RecipientType recipientType,
String... oneOrMoreAddressesEach)
|
@NotNull EmailPopulatingBuilder |
withRecipientsWithFixedName(@Nullable String fixedName,
@NotNull Collection<String> oneOrMoreAddressesEach,
jakarta.mail.Message.RecipientType recipientType)
Delegates to
withRecipients(String, boolean, Collection, Message.RecipientType) , with fixedName=true
assigning or overwriting existing names with the provided name. |
@NotNull EmailPopulatingBuilder |
withRecipientsWithFixedName(@Nullable String name,
jakarta.mail.Message.RecipientType recipientType,
String... oneOrMoreAddressesEach)
|
EmailPopulatingBuilder |
withReplyTo(@NotNull jakarta.mail.internet.InternetAddress replyToAddress)
Delegates to
withReplyTo(Recipient) with a new Recipient wrapped around the given address. |
EmailPopulatingBuilder |
withReplyTo(@NotNull List<Recipient> recipients)
Sets the replyTo address of this email with given
Recipient (ignoring its Message.RecipientType if provided). |
EmailPopulatingBuilder |
withReplyTo(@NotNull Recipient recipient)
Delegates to #withReplyTo(Recipient...)
|
EmailPopulatingBuilder |
withReplyTo(@NotNull String replyToAddress)
Delegates to
withReplyTo(Recipient) with a new Recipient wrapped around the given email address. |
EmailPopulatingBuilder |
withReplyTo(@Nullable String fixedName,
@NotNull jakarta.mail.internet.InternetAddress replyToAddress)
Delegates to
withReplyTo(Recipient) with a new Recipient wrapped around the given fixed name and address. |
EmailPopulatingBuilder |
withReplyTo(@Nullable String fixedName,
@NotNull String replyToAddress)
Delegates to
withReplyTo(Recipient) with a new Recipient wrapped around the given fixed name and email address. |
EmailPopulatingBuilder |
withReturnReceiptTo()
Indicates that we want to use the flag
returnReceiptTo . |
EmailPopulatingBuilder |
withReturnReceiptTo(@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withReturnReceiptTo(Recipient) with a new Recipient wrapped around the provided address. |
EmailPopulatingBuilder |
withReturnReceiptTo(@NotNull Recipient recipient)
Indicates that this email should use the RRT flag "Return-Receipt-To" with the
preconfigured
Recipient . |
EmailPopulatingBuilder |
withReturnReceiptTo(@NotNull String address)
Delegates to
withReturnReceiptTo(Recipient) with a new Recipient wrapped around the provided address. |
EmailPopulatingBuilder |
withReturnReceiptTo(@Nullable String fixedName,
@NotNull jakarta.mail.internet.InternetAddress address)
Delegates to
withReturnReceiptTo(Recipient) with a new Recipient wrapped around the provided fixed name and address. |
EmailPopulatingBuilder |
withReturnReceiptTo(@Nullable String name,
@NotNull String address)
Delegates to
withReturnReceiptTo(Recipient) with a new Recipient wrapped around the provided name and address. |
EmailPopulatingBuilder |
withSubject(@Nullable String subject)
Sets the optional subject of this email.
|
static final Pattern IMG_SRC_PATTERN
<img src="...">
entries in an HTML document.It needs to cater for various things, like more whitespaces including newlines on any
place, HTML is not case-sensitive and there can be arbitrary text between "IMG" and "SRC" like IDs and other things.Email buildEmail()
Email.Email(EmailPopulatingBuilder)
with this
as argument. This results in an Email instance with
just the values set on this builder by the user. This is the regular use case and the common way to send emails using a Mailer
instance.
If you don't have a Mailer instance, or you just want to call helper methods that only accept an EmailWithDefaultsAndOverridesApplied
, there are two ways
to complete this Email with defaults and overrides that you may have configured as (system) properties (files):
EmailGovernanceImpl
or use EmailGovernanceImpl.NO_GOVERNANCE()
, and then use EmailGovernance.produceEmailApplyingDefaultsAndOverrides(Email)
buildEmail()
, but use buildEmailCompletedWithDefaultsAndOverrides()
or buildEmailCompletedWithDefaultsAndOverrides(EmailGovernance)
insteadEmail buildEmailCompletedWithDefaultsAndOverrides()
buildEmailCompletedWithDefaultsAndOverrides(EmailGovernance)
with an empty default email governance, which
will still apply default config (System) properties (files).Email buildEmailCompletedWithDefaultsAndOverrides(@NotNull @NotNull EmailGovernance emailGovernance)
buildEmail()
, but returning the final email version right away. Useful if you don't use a Mailer which works with email governance,
or just want to call a helper method that only accepts EmailWithDefaultsAndOverridesApplied
. For regular cases of just sending with a Mailer
, this
completion stage happens automatically when converting to MimeMessage. In that case use buildEmail()
instead.
Why not always apply defaults and overrides? Because it would be a waste of resources to do so, especially when you are sending multiple emails resuing a mailer instance. Another use case is that when using a server cluster with the batch-module (multiple mailer instances), defaults set during sending ensure that the defaults set for a specific mailer are used. This is sometimes important if an SMTP server needs a specific sender address, or if you want to use a specific DKIM signature bound to that server.
emailGovernance
- The email governance to use for this email. It determines which default values and overrides to apply, what the maximum
email size is, etc.EmailPopulatingBuilder ignoringDefaults(boolean ignoreDefaults)
ignoreDefaults
- Whether to ignore all default values or not for this email.dontApplyDefaultValueFor(EmailProperty...)
,
MailerGenericBuilder.withEmailDefaults(Email)
EmailPopulatingBuilder ignoringOverrides(boolean ignoreOverrides)
ignoreOverrides
- Whether to ignore all overrides values or not for this email.dontApplyOverrideValueFor(EmailProperty...)
,
MailerGenericBuilder.withEmailOverrides(Email)
EmailPopulatingBuilder dontApplyDefaultValueFor(@NotNull org.simplejavamail.internal.config.EmailProperty... configProperties)
EmailGovernance
), but for a specific case or under certain conditions
you might want to have this email untouched by the defaults.
EmailGovernance
as defaults or overrides reference.configProperties
- The properties that should not be configured with default values, if any, when sending the email.EmailStartingBuilder.ignoringDefaults()
EmailPopulatingBuilder dontApplyOverrideValueFor(@NotNull org.simplejavamail.internal.config.EmailProperty... configProperties)
EmailGovernance
), but for a specific case or under certain conditions you might want
to have this email untouched by the overrides.configProperties
- The properties that should not be overridden when sending the email.EmailPopulatingBuilder fixingMessageId(@Nullable @Nullable String id)
Note 1: ID is user-controlled. Only when converting an email, Simple Java Mail might fill the sent-date.
Note 2: The id-format should conform to rfc5322#section-3.6.4
id
- The mime message id, example: <123@456>
EmailPopulatingBuilder from(@NotNull @NotNull String fromAddress)
from(String, String)
with empty name.fromAddress
- The sender address visible to receivers of the email.EmailPopulatingBuilder from(@Nullable @Nullable String name, @NotNull @NotNull String fromAddress)
from(Recipient)
with a new Recipient
wrapped around the given name and email address.name
- The name that will be visible to the receivers of this email.fromAddress
- The address that will be visible to the receivers of this email.EmailPopulatingBuilder from(@Nullable @Nullable String fixedName, @NotNull @NotNull jakarta.mail.internet.InternetAddress fromAddress)
from(Recipient)
with a new Recipient
wrapped around the given fixed name and email address.EmailPopulatingBuilder from(@NotNull @NotNull jakarta.mail.internet.InternetAddress fromAddress)
from(Recipient)
with a new Recipient
wrapped around the given email address.EmailPopulatingBuilder from(@NotNull @NotNull Recipient recipient)
Recipient
(ignoring its Message.RecipientType
if provided).
Can be used in conjunction with one of the replyTo(...)
methods, which is then prioritized by email clients when replying to this
email.
recipient
- Preconfigured recipient which includes optional name and mandatory email address.from(String, String)
,
from(String)
,
withReplyTo(Recipient)
EmailPopulatingBuilder withReplyTo(@NotNull @NotNull String replyToAddress)
withReplyTo(Recipient)
with a new Recipient
wrapped around the given email address.replyToAddress
- The address that receivers will get when they reply to the email.EmailPopulatingBuilder withReplyTo(@Nullable @Nullable String fixedName, @NotNull @NotNull String replyToAddress)
withReplyTo(Recipient)
with a new Recipient
wrapped around the given fixed name and email address.fixedName
- Optional name that receivers will get when they reply to the email.replyToAddress
- The address that receivers will get when they reply to the email. Any name included in the address will be ignored.EmailPopulatingBuilder withReplyTo(@NotNull @NotNull jakarta.mail.internet.InternetAddress replyToAddress)
withReplyTo(Recipient)
with a new Recipient
wrapped around the given address.EmailPopulatingBuilder withReplyTo(@Nullable @Nullable String fixedName, @NotNull @NotNull jakarta.mail.internet.InternetAddress replyToAddress)
withReplyTo(Recipient)
with a new Recipient
wrapped around the given fixed name and address.EmailPopulatingBuilder withReplyTo(@NotNull @NotNull Recipient recipient)
EmailPopulatingBuilder withReplyTo(@NotNull @NotNull List<Recipient> recipients)
Recipient
(ignoring its Message.RecipientType
if provided).
If provided, email clients should prioritize the replyTo recipient over the from recipient when replying to this email.
recipients
- Preconfigured recipients which each includes optional name and mandatory email address.withReplyTo(String, String)
EmailPopulatingBuilder withBounceTo(@Nullable @Nullable String bounceToAddress)
withBounceTo(Recipient)
with a new Recipient
wrapped around the email address (or null if missing).bounceToAddress
- The address of the receiver of the bounced emailEmailPopulatingBuilder withBounceTo(@Nullable @Nullable String name, @NotNull @NotNull String bounceToAddress)
withBounceTo(Recipient)
with a new Recipient
wrapped around the given name and email address.name
- Name of the receiver of the bounced emailbounceToAddress
- The address of the receiver of the bounced emailEmailPopulatingBuilder withBounceTo(@NotNull @NotNull jakarta.mail.internet.InternetAddress bounceToAddress)
withBounceTo(Recipient)
with a new Recipient
wrapped around the given address.EmailPopulatingBuilder withBounceTo(@Nullable @Nullable String name, @NotNull @NotNull jakarta.mail.internet.InternetAddress bounceToAddress)
withBounceTo(Recipient)
with a new Recipient
wrapped around the given fixed name and address.EmailPopulatingBuilder withBounceTo(@Nullable @Nullable Recipient recipient)
Recipient
(ignoring its Message.RecipientType
if provided).
If provided, SMTP server should return bounced emails to this address. This is also known as the Return-Path
(or Envelope
FROM).
recipient
- Preconfigured recipient which includes optional name and mandatory email address.withBounceTo(String, String)
EmailPopulatingBuilder withSubject(@Nullable @Nullable String subject)
subject
- Optional text to be used in the subject field of the email.EmailPopulatingBuilder withPlainText(@NotNull @NotNull File textFile)
withPlainText(String)
.textFile
- Plain text to set as email body (overwrites any previous plain text body). If no HTML body is included as well, plain text
would be used instead by the email client.EmailPopulatingBuilder withPlainText(@Nullable @Nullable String text)
Both text and HTML can be provided, which will be offered to the email client as alternative content. Email clients that support it, will favor HTML over plain text and ignore the text body completely.
text
- Plain text to set as email body (overwrites any previous plain text body). If no HTML body is included as well, plain text
would be used instead by the email client.withPlainText(File)
,
prependText(String)
,
appendText(String)
EmailPopulatingBuilder prependText(@NotNull @NotNull File textFile)
prependText(String)
.textFile
- The plain text to prepend to whatever plain text is already there.EmailPopulatingBuilder prependText(@NotNull @NotNull String text)
text
- The plain text to prepend to whatever plain text is already there.prependText(File)
,
appendText(String)
,
withPlainText(String)
EmailPopulatingBuilder appendText(@NotNull @NotNull File textFile)
appendText(String)
.textFile
- The plain text to append to whatever plain text is already there.EmailPopulatingBuilder appendText(@NotNull @NotNull String text)
text
- The plain text to append to whatever plain text is already there.appendText(File)
,
prependText(String)
,
withPlainText(String)
EmailPopulatingBuilder withHTMLText(@NotNull @NotNull File textHTMLFile)
withHTMLText(String)
.textHTMLFile
- HTML text to set as email body (overwrites any previous HTML text body). If no HTML body is included, plain text
would be used instead by the email client if provided.EmailPopulatingBuilder withHTMLText(@Nullable @Nullable String textHTML)
Both text and HTML can be provided, which will be offered to the email client as alternative content. Email clients that support it, will favor HTML over plain text and ignore the text body completely.
textHTML
- HTML text to set as email body (overwrites any previous HTML text body). If no HTML body is included, plain text
would be used instead by the email client if provided.withHTMLText(File)
,
prependTextHTML(String)
,
appendTextHTML(String)
EmailPopulatingBuilder prependTextHTML(@NotNull @NotNull File textHTMLFile)
prependTextHTML(String)
.textHTMLFile
- The HTML text to prepend to whatever is already there in the body.EmailPopulatingBuilder prependTextHTML(@NotNull @NotNull String textHTML)
textHTML
- The HTML text to prepend to whatever is already there in the body.prependTextHTML(File)
,
appendTextHTML(String)
,
withHTMLText(String)
EmailPopulatingBuilder appendTextHTML(@NotNull @NotNull File textHTMLFile)
appendTextHTML(String)
.textHTMLFile
- The HTML text to append to whatever is already there in the body.EmailPopulatingBuilder appendTextHTML(@NotNull @NotNull String textHTML)
textHTML
- The HTML text to append to whatever is already there in the body.appendTextHTML(File)
,
prependTextHTML(String)
,
withHTMLText(String)
EmailPopulatingBuilder withCalendarText(@NotNull @NotNull CalendarMethod calendarMethod, @NotNull @NotNull String textCalendar)
withPlainText(String)
and withHTMLText(String)
.calendarMethod
- An RFC-2446 VEVENT calendar component method. Example: PUBLISH, REQUEST, REPLY, ADD, CANCEL, REFRESH, COUNTER, DECLINECOUNTER
textCalendar
- free form text, which you can produce with a library such as
ical4j.EmailPopulatingBuilder withContentTransferEncoding(@NotNull @NotNull ContentTransferEncoding contentTransferEncoding)
ContentTransferEncoding.QUOTED_PRINTABLE
, which basicallt means plain
text, so you can just read the content of the EML (if not encrypted).
However, you can choose another encoding as supported by Jakarta Mail. The list is quite extensive, but the most common alternative is base64. This might be useful for example for obfuscating the content to some extent.
contentTransferEncoding
- The encoder to use for the text/html/iCalendar content.EmailPopulatingBuilder to(@NotNull Recipient... recipients)
withRecipients(Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder to(@NotNull @NotNull Collection<Recipient> recipients)
withRecipients(Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder to(@Nullable @Nullable String name, String oneOrMoreAddresses)
withRecipients(String, boolean, Collection, Message.RecipientType)
, with recipientType=
Message.RecipientType#TO
and
fixedName=true
assigning or overwriting existing names with the provided name.name
- The optional name of the TO receiver(s) of the email. If multiples addresses are provided, all addresses will be in
this same name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses of TO receiver(s). Any names included are ignored if a
name was provided. Examples:
EmailPopulatingBuilder to(@NotNull @NotNull String oneOrMoreAddresses)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses. Examples:
EmailPopulatingBuilder to(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
toWithFixedName(String, String...)
.EmailPopulatingBuilder to(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
toWithFixedName(String, Collection)
.EmailPopulatingBuilder toMultiple(@NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.EmailPopulatingBuilder toMultiple(@NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.EmailPopulatingBuilder toWithFixedName(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toWithDefaultName(@NotNull @NotNull String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder to(@Nullable @Nullable String name, jakarta.mail.internet.InternetAddress address)
EmailPopulatingBuilder to(@NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.EmailPopulatingBuilder to(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
EmailPopulatingBuilder toAddresses(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
toAddressesWithFixedName(String, Collection)
.EmailPopulatingBuilder toMultiple(@NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.EmailPopulatingBuilder toMultipleAddresses(@NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
and empty default name.EmailPopulatingBuilder toAddressesWithFixedName(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toAddressesWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder toAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#TO
.EmailPopulatingBuilder cc(@NotNull Recipient... recipients)
withRecipients(Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder cc(@NotNull @NotNull Collection<Recipient> recipients)
withRecipients(Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder cc(@Nullable @Nullable String name, String oneOrMoreAddresses)
withRecipients(String, boolean, Collection, Message.RecipientType)
, with recipientType=
Message.RecipientType#CC
and fixedName=true
assigning or overwriting existing names with the provided name.name
- The optional name of the CC receiver(s) of the email. If multiples addresses are provided, all addresses will be in
this same name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses of CC receiver(s). Any names included are ignored if a
name was provided. Examples:
EmailPopulatingBuilder cc(@NotNull @NotNull String oneOrMoreAddresses)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses. Examples:
EmailPopulatingBuilder cc(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
ccWithFixedName(String, String...)
.EmailPopulatingBuilder cc(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
ccWithFixedName(String, Collection)
.EmailPopulatingBuilder ccMultiple(@NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.EmailPopulatingBuilder ccAddresses(@NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.EmailPopulatingBuilder ccWithFixedName(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccWithDefaultName(@NotNull @NotNull String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder cc(@Nullable @Nullable String name, jakarta.mail.internet.InternetAddress address)
EmailPopulatingBuilder cc(@NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.EmailPopulatingBuilder cc(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
EmailPopulatingBuilder ccAddresses(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
ccAddressesWithFixedName(String, Collection)
.EmailPopulatingBuilder ccMultiple(@NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.EmailPopulatingBuilder ccMultipleAddresses(@NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
and empty default name.EmailPopulatingBuilder ccAddressesWithFixedName(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccAddressesWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder ccAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#CC
.EmailPopulatingBuilder bcc(@NotNull Recipient... recipients)
withRecipients(Collection, Message.RecipientType)
with fixedRecipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bcc(@NotNull @NotNull Collection<Recipient> recipients)
withRecipients(Collection, Message.RecipientType)
with fixedRecipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bcc(@Nullable @Nullable String name, String oneOrMoreAddresses)
withRecipients(String, boolean, Collection, Message.RecipientType)
, with recipientType=
Message.RecipientType#BCC
and fixedName=true
assigning or overwriting existing names with the provided name.name
- The optional name of the BCC receiver(s) of the email. If multiples addresses are provided, all addresses will be in
this same name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses of BCC receiver(s). Any names included are ignored if a
name was provided. Examples:
EmailPopulatingBuilder bcc(@NotNull @NotNull String oneOrMoreAddresses)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.oneOrMoreAddresses
- Single RFC2822 address or delimited list of RFC2822 addresses. Examples:
EmailPopulatingBuilder bcc(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
bccWithFixedName(String, String...)
.EmailPopulatingBuilder bcc(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
bccWithFixedName(String, Collection)
.EmailPopulatingBuilder bccMultiple(@NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.EmailPopulatingBuilder bccAddresses(@NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.EmailPopulatingBuilder bccWithFixedName(@Nullable @Nullable String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccWithDefaultName(@NotNull @NotNull String name, @NotNull String... oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach)
withRecipientsWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bcc(@Nullable @Nullable String name, jakarta.mail.internet.InternetAddress address)
EmailPopulatingBuilder bcc(@NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.EmailPopulatingBuilder bcc(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
EmailPopulatingBuilder bccAddresses(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
EmailPopulatingBuilder bccMultiple(@NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.EmailPopulatingBuilder bccMultipleAddresses(@NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
and empty default name.EmailPopulatingBuilder bccAddressesWithFixedName(@Nullable @Nullable String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull jakarta.mail.internet.InternetAddress... addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccAddressesWithFixedName(@Nullable @Nullable String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithFixedName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.EmailPopulatingBuilder bccAddressesWithDefaultName(@NotNull @NotNull String name, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses)
withAddressesWithDefaultName(String, Collection, Message.RecipientType)
with recipientType=
Message.RecipientType#BCC
.@NotNull @NotNull EmailPopulatingBuilder withRecipientsWithDefaultName(@Nullable @Nullable String defaultName, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipients(String, boolean, Collection, Message.RecipientType)
, leaving existing names intact and defaulting when missing.@NotNull @NotNull EmailPopulatingBuilder withRecipientsWithFixedName(@Nullable @Nullable String fixedName, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipients(String, boolean, Collection, Message.RecipientType)
, with fixedName=true
assigning or overwriting existing names with the provided name.@NotNull @NotNull EmailPopulatingBuilder withRecipientsWithDefaultName(@Nullable @Nullable String name, @Nullable jakarta.mail.Message.RecipientType recipientType, @NotNull String... oneOrMoreAddressesEach)
@NotNull @NotNull EmailPopulatingBuilder withRecipientsWithFixedName(@Nullable @Nullable String name, @Nullable jakarta.mail.Message.RecipientType recipientType, @NotNull String... oneOrMoreAddressesEach)
@NotNull @NotNull EmailPopulatingBuilder withRecipients(@Nullable @Nullable String name, boolean fixedName, @Nullable jakarta.mail.Message.RecipientType recipientType, @NotNull String... oneOrMoreAddressesEach)
@NotNull @NotNull EmailPopulatingBuilder withRecipients(@Nullable @Nullable String name, boolean fixedName, @NotNull @NotNull Collection<String> oneOrMoreAddressesEach, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipient(Recipient)
for each address found in not just the collection, but also in every individual address string
that is in the collection.fixedName
- Indicates whether the provided name should be applied to all addresses, or only to those where a name is
missing.oneOrMoreAddressesEach
- Collection of addresses. Each entry itself can be a delimited list of RFC2822 addresses. Examples:
@NotNull @NotNull EmailPopulatingBuilder withAddressesWithDefaultName(@Nullable @Nullable String defaultName, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses, @Nullable jakarta.mail.Message.RecipientType recipientType)
withAddresses(String, boolean, Collection, Message.RecipientType)
, leaving existing names intact and defaulting when missing.@NotNull @NotNull EmailPopulatingBuilder withAddressesWithFixedName(@Nullable @Nullable String fixedName, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses, @Nullable jakarta.mail.Message.RecipientType recipientType)
withAddresses(String, boolean, Collection, Message.RecipientType)
, with fixedName=true
assigning or overwriting existing names with the provided name.@NotNull @NotNull EmailPopulatingBuilder withAddresses(@Nullable @Nullable String name, boolean fixedName, @NotNull @NotNull Collection<jakarta.mail.internet.InternetAddress> addresses, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipient(String, String, Message.RecipientType)
for each address in the provided collection.fixedName
- Indicates whether the provided name should be applied to all addresses, or only to those where a name is missing.EmailPopulatingBuilder withRecipients(@NotNull @NotNull Collection<Recipient> recipients)
withRecipients(Collection, Message.RecipientType)
with Message.RecipientType
left empty (so it will use the original values).EmailPopulatingBuilder withRecipients(@NotNull Recipient... recipients)
withRecipients(Collection, Message.RecipientType)
with Message.RecipientType
left empty (so it will use the original values).@NotNull @NotNull EmailPopulatingBuilder withRecipients(@NotNull @NotNull Collection<Recipient> recipients, @Nullable jakarta.mail.Message.RecipientType fixedRecipientType)
withRecipient(String, String, Message.RecipientType)
for each recipient in the provided collection, optionally fixing the
recipientType for all recipients to the provided type.fixedRecipientType
- Optional. Fixes all recipients to the given type. If omitted, the types are not removed, but kept as-is.EmailPopulatingBuilder withRecipient(@NotNull @NotNull String singleAddress, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipient(String, String, Message.RecipientType)
with the name omitted.EmailPopulatingBuilder withRecipient(@Nullable @Nullable String name, @NotNull @NotNull String singleAddress, @Nullable jakarta.mail.Message.RecipientType recipientType)
withRecipient(String, boolean, String, Message.RecipientType)
with the name omitted and fixedName = true.EmailPopulatingBuilder withRecipient(@Nullable @Nullable String name, boolean fixedName, @NotNull @NotNull String singleAddress, @Nullable jakarta.mail.Message.RecipientType recipientType)
Recipient
instance with the given name, address and Message.RecipientType
.
Note that the email address must be a single address according to RFC2822 format. Name can be provided explicitly or as part of the RFC2822 email address or omitted completely. If provided as method argument, the name overrides any nested name.
name
- Optional explicit name. Can be included in the email address instead, or omitted completely. A name will show as "Name Here <[email protected]>"
singleAddress
- A single address according to RFC2822 format with or without personal name.recipientType
- Optional type of recipient. This is needed for TO, CC and BCC, but not for bounceTo, returnReceiptTo,
replyTo, from etc.EmailPopulatingBuilder withRecipient(@NotNull @NotNull Recipient recipient)
Recipient
instance as copy of the provided recipient (copying name, address and Message.RecipientType
).
Note that the email address must be a single address according to RFC2822 format. Name can be provided explicitly or as part of the RFC2822 email address or omitted completely.
EmailPopulatingBuilder withEmbeddedImageAutoResolutionForFiles(boolean embeddedImageAutoResolutionForFiles)
Normally, you would manually mark up your HTML with images using cid:<some_id>
and then add an embedded image
resource with the same name (emailBuilder.withEmbeddedImage(..)
). With auto-file-resolution, you can just
refer to the file instead and the data will be included dynamically with a generated cid.
embeddedImageAutoResolutionForFiles
- Enables auto resolution of file datasources for embedded images.withEmbeddedImageBaseDir(String)
,
allowingEmbeddedImageOutsideBaseDir(boolean)
EmailPopulatingBuilder withEmbeddedImageAutoResolutionForClassPathResources(boolean embeddedImageAutoResolutionForClassPathResources)
Normally, you would manually mark up your HTML with images using cid:<some_id>
and then add an embedded image
resource with the same name (emailBuilder.withEmbeddedImage(..)
). With auto-classpath-resolution, you can just
refer to the resource on the classpath instead and the data will be included dynamically with a generated cid.
embeddedImageAutoResolutionForClassPathResources
- Enables auto resolution of classpath datasources for embedded images.withEmbeddedImageBaseClassPath(String)
,
allowingEmbeddedImageOutsideBaseClassPath(boolean)
EmailPopulatingBuilder withEmbeddedImageAutoResolutionForURLs(boolean embeddedImageAutoResolutionForURLs)
Normally, you would manually mark up your HTML with images using cid:<some_id>
and then add an embedded image
resource with the same name (emailBuilder.withEmbeddedImage(..)
). With auto-URL-resolution, you can just
refer to the hosted image instead and the data will be downloaded and included dynamically with a generated cid.
embeddedImageAutoResolutionForURLs
- Enables auto resolution of URL's for embedded images.withEmbeddedImageBaseUrl(String)
,
withEmbeddedImageBaseUrl(URL)
,
allowingEmbeddedImageOutsideBaseUrl(boolean)
EmailPopulatingBuilder withEmbeddedImageBaseDir(@NotNull @NotNull String embeddedImageBaseDir)
Generally you would manually use src="cid:image_name", but files and url's will be located as well dynamically.
embeddedImageBaseDir
- The base folder used when resolving images sources in HTML text.withEmbeddedImageAutoResolutionForFiles(boolean)
,
allowingEmbeddedImageOutsideBaseDir(boolean)
EmailPopulatingBuilder withEmbeddedImageBaseClassPath(@NotNull @NotNull String embeddedImageBaseClassPath)
Generally you would manually use src="cid:image_name", but files and url's will be located as well dynamically.
embeddedImageBaseClassPath
- The classpath base used when resolving images sources in HTML text.withEmbeddedImageAutoResolutionForClassPathResources(boolean)
,
allowingEmbeddedImageOutsideBaseClassPath(boolean)
EmailPopulatingBuilder withEmbeddedImageBaseUrl(@NotNull @NotNull String embeddedImageBaseUrl)
withEmbeddedImageBaseUrl(URL)
.embeddedImageBaseUrl
- The base URL used when resolving images sources in HTML text.withEmbeddedImageAutoResolutionForURLs(boolean)
,
allowingEmbeddedImageOutsideBaseUrl(boolean)
EmailPopulatingBuilder withEmbeddedImageBaseUrl(@NotNull @NotNull URL embeddedImageBaseUrl)
Generally you would manually use src="cid:image_name", but files and url's will be located as well dynamically.
embeddedImageBaseUrl
- The base URL used when resolving images sources in HTML text.withEmbeddedImageAutoResolutionForURLs(boolean)
,
allowingEmbeddedImageOutsideBaseUrl(boolean)
EmailPopulatingBuilder allowingEmbeddedImageOutsideBaseDir(boolean allowEmbeddedImageOutsideBaseDir)
allowEmbeddedImageOutsideBaseDir
- Whether files should be resolved that reside outside the baseDir (if set)withEmbeddedImageAutoResolutionForFiles(boolean)
,
withEmbeddedImageBaseDir(String)
EmailPopulatingBuilder allowingEmbeddedImageOutsideBaseClassPath(boolean allowEmbeddedImageOutsideBaseClassPath)
allowEmbeddedImageOutsideBaseClassPath
- Whether image sources should be resolved that reside outside the baseClassPath (if set)withEmbeddedImageAutoResolutionForClassPathResources(boolean)
,
withEmbeddedImageBaseClassPath(String)
EmailPopulatingBuilder allowingEmbeddedImageOutsideBaseUrl(boolean allowEmbeddedImageOutsideBaseUrl)
allowEmbeddedImageOutsideBaseUrl
- Whether url's should be resolved that reside outside the baseUrl (if set)withEmbeddedImageAutoResolutionForURLs(boolean)
,
withEmbeddedImageBaseUrl(String)
,
withEmbeddedImageBaseUrl(URL)
EmailPopulatingBuilder embeddedImageAutoResolutionMustBeSuccesful(boolean embeddedImageAutoResolutionMustBeSuccesful)
Not using this option effectively means a more lenient approach to image sources.
Note: It also allows you to work with URL's as image sources that can't be resolved at time of sending, but that makes sense when viewing the email in some client (e.g. relative url's).
embeddedImageAutoResolutionMustBeSuccesful
- Whether auto resolution is enforced and bubbles up failure to do so.EmailPopulatingBuilder withEmbeddedImage(@NotNull @NotNull String name, byte[] data, @NotNull @NotNull String mimetype)
withEmbeddedImage(String, DataSource)
, with a named ByteArrayDataSource
created using the provided name, data and
mimetype.name
- The name of the image as being referred to from the message content body (e.g. 'signature').data
- The byte data of the image to be embedded.mimetype
- The content type of the given data (e.g. "image/gif" or "image/jpeg").EmailPopulatingBuilder withEmbeddedImage(@Nullable @Nullable String name, @NotNull @NotNull jakarta.activation.DataSource imagedata)
withAttachment(String, DataSource)
instead.
The provided DataSource
is assumed to be of mimetype png, jpg or whatever the email client supports as valid image embedded in HTML
content.
name
- The name of the image as being referred to from the message content body (e.g. 'src="cid:yourImageName"'). If not provided, the
name of the given data source is used instead.imagedata
- The image data.withEmbeddedImage(String, byte[], String)
,
withEmbeddedImages(List)
EmailPopulatingBuilder withEmbeddedImages(@NotNull @NotNull List<AttachmentResource> embeddedImages)
withEmbeddedImage(String, DataSource)
for each embedded image.<T> EmailPopulatingBuilder withHeaders(@NotNull @NotNull Map<String,Collection<T>> headers)
withHeader(String, Object)
for each header in the provided Map
.EmailPopulatingBuilder withHeader(@NotNull @NotNull String name, @Nullable @Nullable Object value)
withHeader(String, Object, boolean)
with replaceHeader set to false
.name
- The name of the header. Example: withHeader("X-Priority", 2)
value
- The value of the header, which will be stored using String.valueOf(Object)
.EmailPopulatingBuilder withHeader(@NotNull @NotNull String name, @Nullable @Nullable Object value, boolean replaceHeader)
String
. Can be directed to replace the headers collection of values.name
- The name of the header. Example: withHeader("X-Priority", 2)
value
- The value of the header, which will be stored using String.valueOf(Object)
.replaceHeader
- Whether to add the value to an existing collection of values (if any) or create a new collection with only the given value.withHeaders(Map)
EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, byte[] data, @NotNull @NotNull String mimetype)
withAttachment(String, byte[], String, String, ContentTransferEncoding)
with null-description and no forced content transfer encoding.EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, byte[] data, @NotNull @NotNull String mimetype, @Nullable @Nullable String description)
withAttachment(String, byte[], String, String, ContentTransferEncoding)
with no forced content transfer encoding.EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, byte[] data, @NotNull @NotNull String mimetype, @Nullable @Nullable String description, @Nullable @Nullable ContentTransferEncoding contentTransferEncoding)
withAttachment(String, DataSource)
, with a named ByteArrayDataSource
created using the provided name, data and mimetype.name
- Optional name of the attachment (e.g. 'filename.ext'). If omitted, the internal name of the datasource is used. If that too is empty, a name will be generated
using UUID
.data
- The binary data of the attachment.mimetype
- The content type of the given data (e.g. "plain/text", "image/gif" or "application/pdf").description
- An optional description that will find its way in the MimeMEssage with the Content-Description header. This is rarely needed.contentTransferEncoding
- An optional encoder option to force the data encoding while in MimeMessage/EML format.withAttachment(String, DataSource, String, ContentTransferEncoding)
,
withAttachments(List)
EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, @NotNull @NotNull jakarta.activation.DataSource filedata)
withAttachment(String, DataSource, String, ContentTransferEncoding)
with null-description and no forced content transfer encoding.name
- Optional name of the attachment (e.g. 'filename.ext'). If omitted, the internal name of the datasource is used. If that too is empty, a name will be generated
using UUID
.filedata
- The attachment data.EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, @NotNull @NotNull jakarta.activation.DataSource filedata, @Nullable @Nullable String description)
withAttachment(String, DataSource, String, ContentTransferEncoding)
with no forced content transfer encoding.name
- Optional name of the attachment (e.g. 'filename.ext'). If omitted, the internal name of the datasource is used. If that too is empty, a name will be generated
using UUID
.filedata
- The attachment data.description
- An optional description that will find its way in the MimeMEssage with the Content-Description header. This is rarely needed.EmailPopulatingBuilder withAttachment(@Nullable @Nullable String name, @NotNull @NotNull jakarta.activation.DataSource filedata, @Nullable @Nullable String description, @Nullable @Nullable ContentTransferEncoding contentTransferEncoding)
Note: for embedding images instead of attaching them for download, refer to withEmbeddedImage(String, DataSource)
instead.
name
- Optional name of the attachment (e.g. 'filename.ext'). If omitted, the internal name of the datasource is used. If that too is empty, a name will be generated
using UUID
.filedata
- The attachment data.description
- An optional description that will find its way in the MimeMEssage with the Content-Description header. This is rarely needed.contentTransferEncoding
- An optional encoder option to force the data encoding while in MimeMessage/EML format.withAttachment(String, DataSource, String, ContentTransferEncoding)
,
withAttachments(List)
EmailPopulatingBuilder withAttachments(@NotNull @NotNull List<AttachmentResource> attachments)
withAttachment(String, DataSource)
for each attachment.EmailPopulatingBuilder signWithDomainKey(byte[] dkimPrivateKey, @NotNull @NotNull String signingDomain, @NotNull @NotNull String dkimSelector, @Nullable @Nullable Set<String> excludedHeadersFromDkimDefaultSigningList)
Mailer
.
Note: this only works in combination with the "DKIM module".
dkimPrivateKey
- De key content used to sign for the sending party.signingDomain
- The domain being authorized to send.dkimSelector
- Additional domain specifier.excludedHeadersFromDkimDefaultSigningList
- Allows you to exclude headers being signed, as might be the case when another mail transfer agent. For example, Amazon SES doesn't want Message-ID and Date Headers to be signed as they have internal mechanisms to handle these headers.signWithDomainKey(DkimConfig)
EmailPopulatingBuilder signWithDomainKey(@NotNull @NotNull DkimConfig dkimConfig)
EmailPopulatingBuilder signWithSmime(@NotNull @NotNull File pkcs12StoreFile, @NotNull @NotNull String storePassword, @NotNull @NotNull String keyAlias, @NotNull @NotNull String keyPassword, @Nullable @Nullable String signatureAlgorithm)
signWithSmime(SmimeSigningConfig)
.
Note: this only works in combination with the "S/MIME module".
pkcs12StoreFile
- The key store file to use to find the indicated keystorePassword
- The store's passwordkeyAlias
- The name of the certificate in the key store to usekeyPassword
- The password of the certificatesignatureAlgorithm
- The signature algorithm to use for signing. If omitted, the default algorithm is used.
See SmimeSigningConfig
for details.SmimeSigningConfig
EmailPopulatingBuilder signWithSmime(@NotNull @NotNull SmimeSigningConfig smimeSigningConfig)
Note: this only works in combination with the "S/MIME module".
Note: You can also configure your Mailer
instance do sign all emails by default (also has better performance).
SmimeSigningConfig
EmailPopulatingBuilder encryptWithSmime(@NotNull @NotNull File pemFile, @Nullable @Nullable String keyEncapsulationAlgorithm, @Nullable @Nullable String cipherAlgorithm)
encryptWithSmime(SmimeEncryptionConfig)
using the provided PEM file.
Note: this only works in combination with the "S/MIME module".
pemFile
- The recipient's public key to use for encryption.keyEncapsulationAlgorithm
- The key encapsulation algorithm to use for encryption. See SmimeEncryptionConfig
for available values.cipherAlgorithm
- The cipher algorithm to use for encryption. See SmimeEncryptionConfig
for available values.SmimeEncryptionConfig
EmailPopulatingBuilder encryptWithSmime(@NotNull @NotNull SmimeEncryptionConfig smimeEncryptionConfig)
You can sign this email with the public key you received from your recipient. The recipient then is the only person that can decrypt the email with his or her private key.
Note: this only works in combination with the "S/MIME module".
smimeEncryptionConfig
- The recipient's public key to use for encryption.SmimeEncryptionConfig
EmailPopulatingBuilder notMergingSingleSMIMESignedAttachment()
Note: this only works in combination with the "S/MIME module".
EmailPopulatingBuilder withDispositionNotificationTo()
dispositionNotificationTo
. The actual address will default to the replyToRecipient
first if set or else fromRecipient
(the final address is determined when sending this email).withDispositionNotificationTo(Recipient)
EmailPopulatingBuilder withDispositionNotificationTo(@NotNull @NotNull String address)
withDispositionNotificationTo(Recipient)
with a new Recipient
wrapped around the provided address.address
- The address of the receiver of the notificationEmailPopulatingBuilder withDispositionNotificationTo(@Nullable @Nullable String name, @NotNull @NotNull String address)
withDispositionNotificationTo(Recipient)
with a new Recipient
wrapped around the provided name and address.name
- Optional name of the receiver of the notificationaddress
- The address of the receiver of the notificationEmailPopulatingBuilder withDispositionNotificationTo(@NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withDispositionNotificationTo(Recipient)
with a new Recipient
wrapped around the provided address.EmailPopulatingBuilder withDispositionNotificationTo(@Nullable @Nullable String fixedName, @NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withDispositionNotificationTo(Recipient)
with a new Recipient
wrapped around the provided fixed name and address.EmailPopulatingBuilder withDispositionNotificationTo(@NotNull @NotNull Recipient recipient)
Recipient
. This flag can be used to request a return receipt from the recipient to signal that the recipient has read the
email.
This flag may be ignored by SMTP clients (for example gmail ignores it completely, while the Google Apps business suite honors it).
EmailPopulatingBuilder withReturnReceiptTo()
returnReceiptTo
. The actual address will default to the replyToRecipient
first if set
or else fromRecipient
(the final address is determined when sending the email).
For more detailed information, refer to withReturnReceiptTo(Recipient)
.
EmailPopulatingBuilder withReturnReceiptTo(@NotNull @NotNull String address)
withReturnReceiptTo(Recipient)
with a new Recipient
wrapped around the provided address.address
- The address of the receiver of the bounced emailEmailPopulatingBuilder withReturnReceiptTo(@Nullable @Nullable String name, @NotNull @NotNull String address)
withReturnReceiptTo(Recipient)
with a new Recipient
wrapped around the provided name and address.name
- Name of the receiver of the receipt notificationaddress
- The address of the receiver of the receipt notificationEmailPopulatingBuilder withReturnReceiptTo(@NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withReturnReceiptTo(Recipient)
with a new Recipient
wrapped around the provided address.EmailPopulatingBuilder withReturnReceiptTo(@Nullable @Nullable String fixedName, @NotNull @NotNull jakarta.mail.internet.InternetAddress address)
withReturnReceiptTo(Recipient)
with a new Recipient
wrapped around the provided fixed name and address.EmailPopulatingBuilder withReturnReceiptTo(@NotNull @NotNull Recipient recipient)
Recipient
. This flag can be used to request a notification from the SMTP server recipient to signal that the recipient
has read the email.
This flag is rarely used, but your mail server / client might implement this flag to automatically send back a notification that the email was received on the mail server or opened in the client, depending on the chosen implementation.
EmailPopulatingBuilder withOverrideReceivers(@NotNull Recipient... recipients)
withOverrideReceivers(List)
EmailPopulatingBuilder withOverrideReceivers(@NotNull @NotNull List<Recipient> recipients)
Transport.sendMessage(Message, Address[])
). The actual Message will still contain the original recipients, but won't receive a
copy. This is useful for testing purposes.EmailPopulatingBuilder fixingSentDate(@NotNull @NotNull Date sentDate)
Note: the sent date is user-controlled. Only when converting an email, Simple Java Mail might fill the sent-date.
sentDate
- The date to use as sent date.EmailPopulatingBuilder clearId()
EmailPopulatingBuilder clearFromRecipient()
EmailPopulatingBuilder clearReplyTo()
EmailPopulatingBuilder clearBounceTo()
EmailPopulatingBuilder clearPlainText()
EmailPopulatingBuilder clearHTMLText()
EmailPopulatingBuilder clearCalendarText()
EmailPopulatingBuilder clearContentTransferEncoding()
ContentTransferEncoding.QUOTED_PRINTABLE
.EmailPopulatingBuilder clearSubject()
EmailPopulatingBuilder clearRecipients()
EmailPopulatingBuilder clearOverrideReceivers()
withOverrideReceivers(List)
EmailPopulatingBuilder clearEmbeddedImageBaseDir()
null
.EmailPopulatingBuilder clearEmbeddedImageBaseClassPath()
null
.EmailPopulatingBuilder clearEmbeddedImageBaseUrl()
null
.EmailPopulatingBuilder clearEmbeddedImages()
EmailPopulatingBuilder clearAttachments()
EmailPopulatingBuilder clearHeaders()
EmailPopulatingBuilder clearDkim()
Note: this only works in combination with the "DKIM module".
EmailPopulatingBuilder clearSmime()
Note: this only works in combination with the "S/MIME module".
EmailPopulatingBuilder clearDispositionNotificationTo()
EmailPopulatingBuilder clearReturnReceiptTo()
EmailPopulatingBuilder clearSentDate()
EmailPopulatingBuilder clearSMIMESignedAttachmentMergingBehavior()
This can be useful when copying an Email
that was merged (default behavior), to unmerge it.
Note: this only works in combination with the "S/MIME module".
boolean isIgnoreDefaults()
ignoringDefaults(boolean)
boolean isIgnoreOverrides()
ignoringOverrides(boolean)
@Nullable @Nullable Set<org.simplejavamail.internal.config.EmailProperty> getPropertiesNotToApplyDefaultValueFor()
@Nullable @Nullable Set<org.simplejavamail.internal.config.EmailProperty> getPropertiesNotToApplyOverrideValueFor()
@Nullable @Nullable String getId()
fixingMessageId(String)
@Nullable @Nullable Recipient getFromRecipient()
from(Recipient)
@NotNull @NotNull List<Recipient> getReplyToRecipients()
withReplyTo(Recipient)
@Nullable @Nullable Recipient getBounceToRecipient()
withBounceTo(Recipient)
@Nullable @Nullable String getText()
withPlainText(String)
@Nullable @Nullable String getTextHTML()
withHTMLText(String)
@Nullable @Nullable CalendarMethod getCalendarMethod()
withCalendarText(CalendarMethod, String)
@Nullable @Nullable String getTextCalendar()
withCalendarText(CalendarMethod, String)
@Nullable @Nullable ContentTransferEncoding getContentTransferEncoding()
@Nullable @Nullable String getSubject()
withSubject(String)
@NotNull @NotNull List<Recipient> getRecipients()
to(Recipient...)
,
cc(Recipient...)
,
bcc(Recipient...)
@NotNull @NotNull List<AttachmentResource> getEmbeddedImages()
withEmbeddedImage(String, DataSource)
@NotNull @NotNull List<AttachmentResource> getAttachments()
withAttachment(String, DataSource)
@NotNull @NotNull List<AttachmentResource> getDecryptedAttachments()
Note: this only works in combination with the "S/MIME module".
@NotNull @NotNull Map<String,Collection<String>> getHeaders()
@Nullable @Nullable DkimConfig getDkimConfig()
@Nullable @Nullable Boolean getUseDispositionNotificationTo()
@Nullable @Nullable Recipient getDispositionNotificationTo()
@Nullable @Nullable Boolean getUseReturnReceiptTo()
@Nullable @Nullable Recipient getReturnReceiptTo()
@NotNull @NotNull List<Recipient> getOverrideReceivers()
withOverrideReceivers(Recipient...)
@Nullable @Nullable jakarta.mail.internet.MimeMessage getEmailToForward()
@NotNull @NotNull OriginalSmimeDetails getOriginalSmimeDetails()
For example, you can use it to determine if the message was encrypted or signed and also who did the signing.
Note: this only works in combination with the "S/MIME module".
@Nullable @Nullable Email getSmimeSignedEmail()
By default, this message is merged into the parent email, as it is actually the same message (this behavior can be
turned off with notMergingSingleSMIMESignedAttachment()
).
Note: this only works in combination with the "S/MIME module".
boolean isMergeSingleSMIMESignedAttachment()
notMergingSingleSMIMESignedAttachment()
@Nullable @Nullable SmimeSigningConfig getSmimeSigningConfig()
@Nullable @Nullable SmimeEncryptionConfig getSmimeEncryptionConfig()
@Nullable @Nullable Date getSentDate()
fixingSentDate(Date)
Copyright © 2009–2024. All rights reserved.