public abstract class Mailer extends Object
Modifier and Type | Field and Description |
---|---|
protected Vector<EmailAddress> |
bccList |
protected Vector<EmailAddress> |
ccList |
protected Vector<File> |
files |
protected EmailAddress |
from |
protected Vector<Header> |
headers |
protected String |
host |
protected boolean |
includeFileNames |
protected Message |
message |
protected String |
password |
protected int |
port |
protected Vector<EmailAddress> |
replyToList |
protected boolean |
SSL |
protected String |
subject |
protected Task |
task |
protected Vector<EmailAddress> |
toList |
protected String |
user |
Constructor and Description |
---|
Mailer() |
Modifier and Type | Method and Description |
---|---|
protected 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(Vector<EmailAddress> list)
Set the bcc addresses.
|
void |
setCcList(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(Vector<File> files)
Set the files to attach.
|
void |
setFrom(EmailAddress from)
Set the address to send from.
|
void |
setHeaders(Vector<Header> v)
Set the generic headers to add to the email.
|
void |
setHost(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(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(Vector<EmailAddress> list)
Set the replyto addresses.
|
void |
setSSL(boolean ssl)
Set whether to send the mail through SSL.
|
void |
setSubject(String subject)
Set the subject.
|
void |
setTask(Task task)
Set the owning task.
|
void |
setToList(Vector<EmailAddress> list)
Set the to addresses.
|
void |
setUser(String user)
Set the user for smtp auth.
|
protected boolean |
shouldIgnoreInvalidRecipients()
Whether invalid recipients should be ignored.
|
protected Vector<EmailAddress> bccList
protected Vector<EmailAddress> ccList
protected EmailAddress from
protected String host
protected boolean includeFileNames
protected Message message
protected String password
protected int port
protected Vector<EmailAddress> replyToList
protected boolean SSL
protected String subject
protected Task task
protected Vector<EmailAddress> toList
protected String user
protected final String getDate()
protected boolean isPortExplicitlySpecified()
protected boolean isStartTLSEnabled()
public abstract void send() throws BuildException
BuildException
- if the email can't be sent.public void setBccList(Vector<EmailAddress> list)
list
- a vector of the bcc addresses.public void setCcList(Vector<EmailAddress> list)
list
- a vector of cc addresses.public void setEnableStartTLS(boolean b)
b
- boolean; if true STARTTLS will be supported.public void setFiles(Vector<File> files)
files
- list of files to attach to the email.public void setFrom(EmailAddress from)
from
- the sender.public void setHeaders(Vector<Header> v)
v
- a Vector presumed to contain Header objects.public void setHost(String host)
host
- the mail server name.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.
public void setIncludeFileNames(boolean b)
b
- if true list attached file names in the body content.public void setMessage(Message m)
m
- the message content.public void setPassword(String password)
password
- the authentication password.public void setPort(int port)
port
- the SMTP port.public void setPortExplicitlySpecified(boolean explicit)
public void setReplyToList(Vector<EmailAddress> list)
list
- a vector of reployTo addresses.public void setSSL(boolean ssl)
ssl
- if true use SSL transport.public void setSubject(String subject)
subject
- the subject line.public void setTask(Task task)
task
- the owning task instance.public void setToList(Vector<EmailAddress> list)
list
- a vector of recipient addresses.public void setUser(String user)
user
- the username.protected boolean shouldIgnoreInvalidRecipients()