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 |
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 |
addRecipient(String name,
String address,
javax.mail.Message.RecipientType type)
Adds a new
Recipient to the list on account of name, address and recipient type (eg. |
void |
addRecipients(javax.mail.Message.RecipientType type,
String... recipientEmailAddressesToAdd)
Adds all given recipients addresses to the list on account of address and recipient type (eg.
|
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 emailAddressList,
javax.mail.Message.RecipientType type)
Adds a new
Recipient to the list on account of name, address and recipient type (eg. |
boolean |
equals(Object o) |
List<AttachmentResource> |
getAttachments()
Bean getter for
attachments as unmodifiable list. |
File |
getDkimPrivateKeyFile() |
InputStream |
getDkimPrivateKeyInputStream() |
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. |
List<Recipient> |
getRecipients()
Bean getter for
recipients as unmodifiable list. |
Recipient |
getReplyToRecipient()
Bean getter for
replyToRecipient . |
String |
getSelector() |
String |
getSigningDomain() |
String |
getSubject()
Bean getter for
subject . |
String |
getText()
Bean getter for
text . |
String |
getTextHTML()
Bean getter for
textHTML . |
int |
hashCode() |
boolean |
isApplyDKIMSignature() |
void |
setFromAddress(String name,
String fromAddress)
Sets the sender address.
|
void |
setReplyToAddress(String name,
String replyToAddress)
Sets the reply-to address (optional).
|
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 |
signWithDomainKey(File dkimPrivateKeyFile,
String signingDomain,
String selector)
As
signWithDomainKey(InputStream, String, String) , but with a File reference that is later read as InputStream . |
void |
signWithDomainKey(InputStream dkimPrivateKeyInputStream,
String signingDomain,
String selector)
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 selector)
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 selector)
Mailer
.
Also see:
dkimPrivateKeyInputStream
- De key content used to sign for the sending party.signingDomain
- The domain being authorized to send.selector
- Additional domain specifier.public void setFromAddress(@Nullable String name, @Nonnull String fromAddress)
name
- The sender's name.fromAddress
- The sender's email 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 addRecipient(@Nullable String name, @Nonnull String address, @Nonnull javax.mail.Message.RecipientType type)
Recipient
to the list on account of name, address and recipient type (eg. Message.RecipientType.CC
).name
- The name of the recipient.address
- The emailadres of the recipient.type
- The type of receiver (eg. Message.RecipientType.CC
).recipients
,
Recipient
,
Message.RecipientType
public void addRecipients(@Nonnull String emailAddressList, @Nonnull javax.mail.Message.RecipientType type)
Recipient
to the list on account of name, address and recipient type (eg. Message.RecipientType.CC
).emailAddressList
- The emailadres of the recipient or recipients separated by comma or semicolon.type
- The type of receiver (eg. Message.RecipientType.CC
).recipients
,
Recipient
,
Message.RecipientType
public void addRecipients(@Nonnull javax.mail.Message.RecipientType type, @Nonnull String... recipientEmailAddressesToAdd)
Message.RecipientType.CC
).recipientEmailAddressesToAdd
- List of preconfigured recipients.recipients
,
Recipient
,
Message.RecipientType
public 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.RecipientType
public 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 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 getSigningDomain()
public String getSelector()
Copyright © 2017. All rights reserved.