public class Email extends Object
| Constructor and Description |
|---|
Email()
Constructor, creates all internal lists.
|
Email(boolean readFromDefaults) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttachment(String name,
byte[] data,
String mimetype)
Adds an attachment to the email message and generates the necessary
DataSource with the given byte data. |
void |
addAttachment(String name,
DataSource filedata)
Overloaded method which sets an attachment on account of name and
DataSource. |
void |
addBccRecipients(String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.BCC. |
void |
addCcRecipients(String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.CC. |
void |
addEmbeddedImage(String name,
byte[] data,
String mimetype)
Adds an embedded image (attachment type) to the email message and generates the necessary
DataSource with the given byte data. |
void |
addEmbeddedImage(String name,
DataSource imagedata)
Overloaded method which sets an embedded image on account of name and
DataSource. |
void |
addHeader(String name,
Object value)
Adds a header to the
headers list. |
void |
addNamedBccRecipients(String name,
String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using Message.RecipientType.BCC. |
void |
addNamedCcRecipients(String name,
String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using Message.RecipientType.CC. |
void |
addNamedToRecipients(String name,
String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using Message.RecipientType.TO. |
void |
addRecipients(Recipient... recipientsToAdd)
Adds all given
Recipient instances to the list (as copies) on account of name, address and recipient type (eg. |
void |
addRecipients(String recipientName,
javax.mail.Message.RecipientType type,
String... recipientEmailAddressesToAdd)
Adds all given recipients addresses to the list on account of address and recipient type (eg.
|
void |
addToRecipients(String... delimitedEmailAddresses)
Delegates to
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.TO. |
boolean |
equals(Object o) |
List<AttachmentResource> |
getAttachments()
Bean getter for
attachments as unmodifiable list. |
Recipient |
getDispositionNotificationTo()
Bean getter for
dispositionNotificationTo. |
File |
getDkimPrivateKeyFile() |
InputStream |
getDkimPrivateKeyInputStream() |
String |
getDkimSelector() |
String |
getDkimSigningDomain() |
List<AttachmentResource> |
getEmbeddedImages()
Bean getter for
embeddedImages as unmodifiable list. |
Recipient |
getFromRecipient()
Bean getter for
fromRecipient. |
Map<String,String> |
getHeaders()
Bean getter for
headers as unmodifiable map. |
String |
getId()
Bean getter for
id. |
List<Recipient> |
getRecipients()
Bean getter for
recipients as unmodifiable list. |
Recipient |
getReplyToRecipient()
Bean getter for
replyToRecipient. |
Recipient |
getReturnReceiptTo()
Bean getter for
returnReceiptTo. |
String |
getSubject()
Bean getter for
subject. |
String |
getText()
Bean getter for
text. |
String |
getTextHTML()
Bean getter for
textHTML. |
int |
hashCode() |
boolean |
isApplyDKIMSignature() |
boolean |
isUseDispositionNotificationTo()
Bean getter for
useDispositionNotificationTo. |
boolean |
isUseReturnReceiptTo()
Bean getter for
useReturnReceiptTo. |
void |
setDispositionNotificationTo(Recipient dispositionNotificationTo)
Bean setter for
dispositionNotificationTo. |
void |
setFromAddress(Recipient recipient)
Sets the sender address from a preconfigured
Recipient object.. |
void |
setFromAddress(String name,
String fromAddress)
Sets the sender address.
|
void |
setId(String id)
Bean setter for
id. |
void |
setReplyToAddress(Recipient recipient)
Sets the reply-to address from a preconfigured
Recipient object.. |
void |
setReplyToAddress(String name,
String replyToAddress)
Sets the reply-to address (optional).
|
void |
setReturnReceiptTo(Recipient returnReceiptTo)
Bean setter for
returnReceiptTo. |
void |
setSubject(String subject)
Bean setter for
subject. |
void |
setText(String text)
Bean setter for
text. |
void |
setTextHTML(String textHTML)
Bean setter for
textHTML. |
void |
setUseDispositionNotificationTo(boolean useDispositionNotificationTo)
Bean setter for
useDispositionNotificationTo. |
void |
setUseReturnReceiptTo(boolean useReturnReceiptTo)
Bean setter for
useReturnReceiptTo. |
void |
signWithDomainKey(File dkimPrivateKeyFile,
String signingDomain,
String dkimSelector)
As
signWithDomainKey(InputStream, String, String), but with a File reference that is later read as InputStream. |
void |
signWithDomainKey(InputStream dkimPrivateKeyInputStream,
String signingDomain,
String dkimSelector)
Primes this email for signing with a DKIM domain key.
|
String |
toString() |
public Email()
public Email(boolean readFromDefaults)
public void signWithDomainKey(@Nonnull File dkimPrivateKeyFile, @Nonnull String signingDomain, @Nonnull String dkimSelector)
signWithDomainKey(InputStream, String, String), but with a File reference that is later read as InputStream.public void signWithDomainKey(@Nonnull InputStream dkimPrivateKeyInputStream, @Nonnull String signingDomain, @Nonnull String dkimSelector)
Mailer.
Also see:
dkimPrivateKeyInputStream - De key content used to sign for the sending party.signingDomain - The domain being authorized to send.dkimSelector - Additional domain specifier.public void setFromAddress(@Nullable String name, @Nonnull String fromAddress)
name - The sender's name.fromAddress - The sender's email address, mandatory.public void setFromAddress(@Nonnull Recipient recipient)
Recipient object..recipient - The Recipient optional name and mandatory address.public void setReplyToAddress(@Nullable String name, @Nonnull String replyToAddress)
name - The replied-to-receiver name.replyToAddress - The replied-to-receiver email address.public void setReplyToAddress(@Nonnull Recipient recipient)
Recipient object..recipient - The Recipient optional name and mandatory address.public void setUseDispositionNotificationTo(boolean useDispositionNotificationTo)
useDispositionNotificationTo.public void setDispositionNotificationTo(Recipient dispositionNotificationTo)
dispositionNotificationTo.public void setUseReturnReceiptTo(boolean useReturnReceiptTo)
useReturnReceiptTo.public void setReturnReceiptTo(Recipient returnReceiptTo)
returnReceiptTo.public void addToRecipients(@Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.TO.public void addCcRecipients(@Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.CC.public void addBccRecipients(@Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using empty default name and Message.RecipientType.BCC.public void addNamedToRecipients(@Nullable String name, @Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using Message.RecipientType.TO.public void addNamedCcRecipients(@Nullable String name, @Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using Message.RecipientType.CC.public void addNamedBccRecipients(@Nullable String name, @Nonnull String... delimitedEmailAddresses)
#addRecipients(String, RecipientType, String...), using Message.RecipientType.BCC.public void addRecipients(@Nullable String recipientName, @Nonnull javax.mail.Message.RecipientType type, @Nonnull String... recipientEmailAddressesToAdd)
Message.RecipientType.CC).
Email address can be of format "address@domain.com[,;*]" or "Recipient Name <address@domain.com>[,;*]". Included names would
override the default recipientName provided.
recipientName - The optional name to use for each email address in the recipientEmailAddressesToAdd.recipientEmailAddressesToAdd - List of (preconfigured) recipients (with or without names, overriding the default name if included).recipients,
Recipient,
Message.RecipientTypepublic void addRecipients(@Nonnull Recipient... recipientsToAdd)
Recipient instances to the list (as copies) on account of name, address and recipient type (eg. Message.RecipientType.CC).recipientsToAdd - List of preconfigured recipients.recipients,
Recipient,
Message.RecipientTypepublic void addEmbeddedImage(@Nonnull String name, @Nonnull byte[] data, @Nonnull String mimetype)
DataSource with the given byte data. Then
delegates to addEmbeddedImage(String, DataSource). At this point the datasource is actually a ByteArrayDataSource.name - The name of the image as being referred to from the message content body (eg. 'signature').data - The byte data of the image to be embedded.mimetype - The content type of the given data (eg. "image/gif" or "image/jpeg").ByteArrayDataSource,
addEmbeddedImage(String, DataSource)public void addEmbeddedImage(@Nullable String name, @Nonnull DataSource imagedata)
DataSource.name - The name of the image as being referred to from the message content body (eg. 'embeddedimage').imagedata - The image data.public void addHeader(@Nonnull String name, @Nonnull Object value)
headers list. The value is stored as a String. example: email.addHeader("X-Priority",
2)name - The name of the header.value - The value of the header, which will be stored using String.valueOf(Object).public void addAttachment(@Nonnull String name, @Nonnull byte[] data, @Nonnull String mimetype)
DataSource with the given byte data. Then delegates to addAttachment(String, DataSource). At this point the datasource is actually a ByteArrayDataSource.name - The name of the extension (eg. filename including extension).data - The byte data of the attachment.mimetype - The content type of the given data (eg. "plain/text", "image/gif" or "application/pdf").ByteArrayDataSource,
addAttachment(String, DataSource)public void addAttachment(@Nullable String name, @Nonnull DataSource filedata)
DataSource.name - The name of the attachment (eg. 'filename.ext').filedata - The attachment data.public Recipient getFromRecipient()
fromRecipient.public Recipient getReplyToRecipient()
replyToRecipient.public boolean isUseDispositionNotificationTo()
useDispositionNotificationTo.public Recipient getDispositionNotificationTo()
dispositionNotificationTo.public boolean isUseReturnReceiptTo()
useReturnReceiptTo.public Recipient getReturnReceiptTo()
returnReceiptTo.public List<AttachmentResource> getAttachments()
attachments as unmodifiable list.public List<AttachmentResource> getEmbeddedImages()
embeddedImages as unmodifiable list.public List<Recipient> getRecipients()
recipients as unmodifiable list.public boolean isApplyDKIMSignature()
public InputStream getDkimPrivateKeyInputStream()
public File getDkimPrivateKeyFile()
public String getDkimSigningDomain()
public String getDkimSelector()
Copyright © 2017. All rights reserved.