public abstract class CommonEmail<T extends CommonEmail<T>>
extends java.lang.Object
Email
and ReceivedEmail
.Modifier and Type | Field and Description |
---|---|
static int |
PRIORITY_HIGH |
static int |
PRIORITY_HIGHEST |
static int |
PRIORITY_LOW |
static int |
PRIORITY_LOWEST |
static int |
PRIORITY_NORMAL |
static java.lang.String |
X_PRIORITY |
Constructor and Description |
---|
CommonEmail() |
Modifier and Type | Method and Description |
---|---|
protected T |
_this() |
T |
attachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
Adds
EmailAttachment . |
T |
attachment(EmailAttachmentBuilder builder) |
java.util.List<EmailAttachment<? extends javax.activation.DataSource>> |
attachments()
Returns the list of all
EmailAttachment s. |
T |
attachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments)
Adds
EmailAttachment s. |
EmailAddress[] |
cc()
Returns CC addresses.
|
T |
cc(javax.mail.Address... ccs)
Sets one or more CC address.
|
T |
cc(javax.mail.Address cc)
Appends CC address.
|
T |
cc(EmailAddress... ccs)
Appends CC addresses.
|
T |
cc(EmailAddress to)
Appends CC address.
|
T |
cc(java.lang.String... ccs)
Sets one or more CC address.
|
T |
cc(java.lang.String cc)
Appends CC address.
|
T |
cc(java.lang.String personalName,
java.lang.String cc)
Appends CC address.
|
abstract T |
clone()
Clones the email with all its necessary data.
|
T |
embeddedAttachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
Embed
EmailAttachment to last message. |
T |
embeddedAttachment(EmailAttachmentBuilder builder)
Attaches the embedded attachment: Content ID will be set if missing from attachment's file name.
|
EmailAddress |
from()
Returns FROM
EmailAddress . |
T |
from(javax.mail.Address from)
Sets the FROM address from
Address . |
T |
from(EmailAddress from)
Sets the FROM address.
|
T |
from(java.lang.String from)
Sets the FROM address.
|
T |
from(java.lang.String personalName,
java.lang.String from)
Sets the FROM address by providing personal name and address.
|
java.lang.String |
header(java.lang.String name)
Returns the value of a header.
|
T |
header(java.lang.String name,
java.lang.String value)
Sets header value.
|
protected java.util.Map<java.lang.String,java.lang.String> |
headers()
Returns all headers as a
HashMap . |
T |
headers(java.util.Enumeration<javax.mail.Header> headersToSet)
Sets headers.
|
T |
headers(java.util.Map<java.lang.String,java.lang.String> headersToSet)
Sets headers.
|
T |
htmlMessage(java.lang.String html)
Adds HTML message.
|
T |
htmlMessage(java.lang.String html,
java.lang.String encoding)
Adds HTML message.
|
T |
message(EmailMessage msgToAdd)
Adds an
EmailMessage . |
T |
message(java.util.List<EmailMessage> msgsToAdd)
Adds multiple messages.
|
T |
message(java.lang.String text,
java.lang.String mimeType)
Adds a
EmailMessage . |
T |
message(java.lang.String text,
java.lang.String mimeType,
java.lang.String encoding)
Adds a
EmailMessage . |
java.util.List<EmailMessage> |
messages()
Returns all messages.
|
int |
priority()
Returns emails priority (1 - 5) or
-1 if priority not available. |
T |
priority(int priority)
Sets email priority.
|
EmailAddress[] |
replyTo()
Returns REPLY-TO addresses.
|
T |
replyTo(javax.mail.Address... replyTos)
Appeds one or more REPLY-TO address.
|
T |
replyTo(javax.mail.Address replyTo)
Appends REPLY-TO address.
|
T |
replyTo(EmailAddress... replyTo)
Appends REPLY-TO addresses.
|
T |
replyTo(EmailAddress replyTo)
Appends REPLY-TO address.
|
T |
replyTo(java.lang.String... replyTos)
Appends one or more REPLY-TO address.
|
T |
replyTo(java.lang.String replyTo)
Appends REPLY-TO address.
|
T |
replyTo(java.lang.String personalName,
java.lang.String replyTo)
Appends REPLY-TO address.
|
T |
resetCc()
Resets all CC addresses.
|
T |
resetReplyTo()
Resets all REPLY-To addresses.
|
T |
resetTo()
Resets TO addresses.
|
java.util.Date |
sentDate()
Returns email's sent date.
|
T |
sentDate(java.util.Date date)
Sets email's sent date.
|
protected T |
storeAttachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
Adds
EmailAttachment . |
protected T |
storeAttachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments)
Adds
EmailAttachment s. |
java.lang.String |
subject()
Returns message subject.
|
T |
subject(java.lang.String subject)
Sets message subject.
|
T |
subject(java.lang.String subject,
java.lang.String encoding)
Sets message subject with specified encoding to override default platform encoding.
|
java.lang.String |
subjectEncoding()
Returns the message subject encoding.
|
T |
textMessage(java.lang.String text)
Adds plain message text.
|
T |
textMessage(java.lang.String text,
java.lang.String encoding)
Adds plain message text.
|
EmailAddress[] |
to()
Returns TO addresses.
|
T |
to(javax.mail.Address... tos)
Appends one or more TO addresses.
|
T |
to(javax.mail.Address to)
Appends TO address from
Address . |
T |
to(EmailAddress... tos)
Appends TO addresses.
|
T |
to(EmailAddress to)
Appends TO address.
|
T |
to(java.lang.String... tos)
Appends one or more TO address.
|
T |
to(java.lang.String to)
Appends TO address.
|
T |
to(java.lang.String personalName,
java.lang.String to)
Appends TO address by personal name and email address.
|
java.lang.String |
toString() |
protected EmailAddress[] |
valueOrEmptyArray(EmailAddress[] arr) |
public static final java.lang.String X_PRIORITY
public static final int PRIORITY_HIGHEST
public static final int PRIORITY_HIGH
public static final int PRIORITY_NORMAL
public static final int PRIORITY_LOW
public static final int PRIORITY_LOWEST
protected T _this()
public abstract T clone()
clone
in class java.lang.Object
public T from(EmailAddress from)
from
- EmailAddress
.public T from(javax.mail.Address from)
Address
.from
- Address
from(EmailAddress)
public T from(java.lang.String from)
from
- Address may be specified with personal name like this: Jenny Doe <email@foo.com>
.from(EmailAddress)
public T from(java.lang.String personalName, java.lang.String from)
personalName
- personal name.from
- email address.from(EmailAddress)
public EmailAddress from()
EmailAddress
.public T to(EmailAddress to)
to
- EmailAddress
to add.public T to(java.lang.String to)
to
- Address may be specified with personal name like this: Jenny Doe <email@foo.com>
.to(EmailAddress)
public T to(java.lang.String personalName, java.lang.String to)
personalName
- personal name.to
- email address.to(EmailAddress)
public T to(javax.mail.Address to)
Address
.to
- Address
to add.to(EmailAddress)
public T to(java.lang.String... tos)
tos
- Address may be specified with personal name like this: Jenny Doe <email@foo.com>
.to(EmailAddress...)
public T to(javax.mail.Address... tos)
tos
- array of Address
s to set.to(EmailAddress...)
public T to(EmailAddress... tos)
tos
- vararg of EmailAddress
es to set.public EmailAddress[] to()
public T resetTo()
public T replyTo(EmailAddress replyTo)
replyTo
- EmailAddress
to add.public T replyTo(java.lang.String replyTo)
replyTo
- Address may be specified with personal name like this: Jenny Doe <email@foo.com>
.replyTo(EmailAddress)
public T replyTo(java.lang.String personalName, java.lang.String replyTo)
personalName
- personal name.replyTo
- email address.replyTo(EmailAddress)
public T replyTo(javax.mail.Address replyTo)
replyTo
- Address
to add.replyTo(EmailAddress)
public T replyTo(java.lang.String... replyTos)
replyTos
- array of EmailAddress
es to set.replyTo(EmailAddress...)
public T replyTo(javax.mail.Address... replyTos)
replyTos
- array of Address
es to set.replyTo(EmailAddress...)
public T replyTo(EmailAddress... replyTo)
replyTo
- vararg of EmailAddress
es to set.public EmailAddress[] replyTo()
public T resetReplyTo()
public T cc(EmailAddress to)
to
- EmailAddress
to add.public T cc(java.lang.String cc)
cc
- Address may be specified with personal name like this: Jenny Doe <email@foo.com>
.cc(EmailAddress)
public T cc(java.lang.String personalName, java.lang.String cc)
personalName
- personal name.cc
- email address.cc(EmailAddress)
public T cc(javax.mail.Address cc)
cc
- Address
to add.cc(EmailAddress)
public T cc(java.lang.String... ccs)
ccs
- array of String
s to set.cc(EmailAddress...)
public T cc(javax.mail.Address... ccs)
ccs
- array of Address
s to set.cc(EmailAddress...)
public T cc(EmailAddress... ccs)
ccs
- vararg of EmailAddress
es to set.public EmailAddress[] cc()
public T resetCc()
public T subject(java.lang.String subject)
subject
- The message subject to set.public T subject(java.lang.String subject, java.lang.String encoding)
MimeMessage.setSubject(String, String)
.subject
- The message subjectencoding
- The encoding for the message subject.public java.lang.String subject()
public java.lang.String subjectEncoding()
public java.util.List<EmailMessage> messages()
public T message(java.util.List<EmailMessage> msgsToAdd)
msgsToAdd
- List
of EmailMessage
s to add.public T message(EmailMessage msgToAdd)
EmailMessage
.msgToAdd
- EmailMessage
to add.public T message(java.lang.String text, java.lang.String mimeType, java.lang.String encoding)
EmailMessage
.text
- The text to add as a String
.mimeType
- The MIME type as a String
.encoding
- The encoding as a String
.message(EmailMessage)
public T message(java.lang.String text, java.lang.String mimeType)
EmailMessage
.text
- The text to add as a String
.mimeType
- The MIME type as a String
.message(EmailMessage)
public T textMessage(java.lang.String text)
text
- The text to add as a String
.message(String, String)
public T textMessage(java.lang.String text, java.lang.String encoding)
text
- The text to add as a String
.encoding
- The encoding as a String
.message(EmailMessage)
public T htmlMessage(java.lang.String html)
html
- The HTML to add as a String
.message(EmailMessage)
public T htmlMessage(java.lang.String html, java.lang.String encoding)
html
- The HTML to add as a String
.encoding
- The encoding as a String
.message(EmailMessage)
protected java.util.Map<java.lang.String,java.lang.String> headers()
HashMap
.HashMap
public T header(java.lang.String name, java.lang.String value)
name
- The name of the header.value
- The value of the header.public T headers(java.util.Map<java.lang.String,java.lang.String> headersToSet)
headersToSet
- Headers to set.public T headers(java.util.Enumeration<javax.mail.Header> headersToSet)
headersToSet
- Headers to set.header(String, String)
public java.lang.String header(java.lang.String name)
name
- The name of the header.public T priority(int priority)
priority
- - Values of 1 through 5 are acceptable, with 1 being the highest priority, 3 = normal
and 5 = lowest priority.public int priority()
-1
if priority not available.priority(int)
public java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments()
EmailAttachment
s.EmailAttachment
s. Returns empty list if no attachment is available.protected T storeAttachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments)
EmailAttachment
s.attachments
- List
of EmailAttachment
s to add.protected T storeAttachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
EmailAttachment
.attachment
- EmailAttachment
to add.public T attachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments)
EmailAttachment
s.attachments
- List
of EmailAttachment
s to add.public T attachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
EmailAttachment
. Content ID will be set to null
.attachment
- EmailAttachment
to add.public T attachment(EmailAttachmentBuilder builder)
attachment(EmailAttachment)
public T embeddedAttachment(EmailAttachmentBuilder builder)
builder
- EmailAttachmentBuilder
embeddedAttachment(EmailAttachment)
public T embeddedAttachment(EmailAttachment<? extends javax.activation.DataSource> attachment)
EmailAttachment
to last message. No header is changed.attachment
- EmailAttachment
storeAttachment(EmailAttachment)
public T sentDate(java.util.Date date)
date
- - Email's sent date. If null
, then date will be set during the process of sending.public java.util.Date sentDate()
null
, then date
will be set during the process of sending.null
if it will be set later.public java.lang.String toString()
toString
in class java.lang.Object
protected EmailAddress[] valueOrEmptyArray(EmailAddress[] arr)
Copyright © 2003-present Jodd Team