public abstract class Mailer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector<EmailAddress> |
bccList |
protected java.util.Vector<EmailAddress> |
ccList |
protected java.util.Vector<java.io.File> |
files |
protected EmailAddress |
from |
protected java.util.Vector<Header> |
headers |
protected java.lang.String |
host |
protected boolean |
includeFileNames |
protected Message |
message |
protected java.lang.String |
password |
protected int |
port |
protected java.util.Vector<EmailAddress> |
replyToList |
protected boolean |
SSL |
protected java.lang.String |
subject |
protected Task |
task |
protected java.util.Vector<EmailAddress> |
toList |
protected java.lang.String |
user |
Constructor and Description |
---|
Mailer() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getDate()
Return the current Date in a format suitable for a SMTP date
header.
|
protected boolean |
isPortExplicitlySpecified()
Whether the port has been explicitly specified by the user.
|
protected boolean |
isStartTLSEnabled() |
abstract void |
send()
Send the email.
|
void |
setBccList(java.util.Vector<EmailAddress> list)
Set the bcc addresses.
|
void |
setCcList(java.util.Vector<EmailAddress> list)
Set the cc addresses.
|
void |
setEnableStartTLS(boolean b)
Set whether to allow authentication to switch to a TLS
connection via STARTTLS.
|
void |
setFiles(java.util.Vector<java.io.File> files)
Set the files to attach.
|
void |
setFrom(EmailAddress from)
Set the address to send from.
|
void |
setHeaders(java.util.Vector<Header> v)
Set the generic headers to add to the email.
|
void |
setHost(java.lang.String host)
Set the mail server.
|
void |
setIgnoreInvalidRecipients(boolean b)
Whether invalid recipients should be ignored (but a warning
will be logged) instead of making the task fail.
|
void |
setIncludeFileNames(boolean b)
Indicate whether filenames should be listed in the body.
|
void |
setMessage(Message m)
Set the message.
|
void |
setPassword(java.lang.String password)
Set the password for smtp auth.
|
void |
setPort(int port)
Set the smtp port.
|
void |
setPortExplicitlySpecified(boolean explicit)
Whether the port has been explicitly specified by the user.
|
void |
setReplyToList(java.util.Vector<EmailAddress> list)
Set the replyTo addresses.
|
void |
setSSL(boolean ssl)
Set whether to send the mail through SSL.
|
void |
setSubject(java.lang.String subject)
Set the subject.
|
void |
setTask(Task task)
Set the owning task.
|
void |
setToList(java.util.Vector<EmailAddress> list)
Set the to addresses.
|
void |
setUser(java.lang.String user)
Set the user for smtp auth.
|
protected boolean |
shouldIgnoreInvalidRecipients()
Whether invalid recipients should be ignored.
|
protected java.lang.String host
protected int port
protected java.lang.String user
protected java.lang.String password
protected boolean SSL
protected Message message
protected EmailAddress from
protected java.util.Vector<EmailAddress> replyToList
protected java.util.Vector<EmailAddress> toList
protected java.util.Vector<EmailAddress> ccList
protected java.util.Vector<EmailAddress> bccList
protected java.util.Vector<java.io.File> files
protected java.lang.String subject
protected Task task
protected boolean includeFileNames
protected java.util.Vector<Header> headers
public void setHost(java.lang.String host)
host
- the mail server name.public void setPort(int port)
port
- the SMTP port.public void setPortExplicitlySpecified(boolean explicit)
explicit
- booleanprotected boolean isPortExplicitlySpecified()
public void setUser(java.lang.String user)
user
- the username.public void setPassword(java.lang.String password)
password
- the authentication password.public void setSSL(boolean ssl)
ssl
- if true use SSL transport.public void setEnableStartTLS(boolean b)
b
- boolean; if true STARTTLS will be supported.protected boolean isStartTLSEnabled()
public void setMessage(Message m)
m
- the message content.public void setFrom(EmailAddress from)
from
- the sender.public void setReplyToList(java.util.Vector<EmailAddress> list)
list
- a vector of replyTo addresses.public void setToList(java.util.Vector<EmailAddress> list)
list
- a vector of recipient addresses.public void setCcList(java.util.Vector<EmailAddress> list)
list
- a vector of cc addresses.public void setBccList(java.util.Vector<EmailAddress> list)
list
- a vector of the bcc addresses.public void setFiles(java.util.Vector<java.io.File> files)
files
- list of files to attach to the email.public void setSubject(java.lang.String subject)
subject
- the subject line.public void setTask(Task task)
task
- the owning task instance.public void setIncludeFileNames(boolean b)
b
- if true list attached file names in the body content.public void setHeaders(java.util.Vector<Header> v)
v
- a Vector presumed to contain Header objects.public abstract void send() throws BuildException
BuildException
- if the email can't be sent.public void setIgnoreInvalidRecipients(boolean b)
Even with this property set to true the task will still fail if the mail couldn't be sent to any recipient at all.
b
- booleanprotected boolean shouldIgnoreInvalidRecipients()
protected final java.lang.String getDate()