Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.email

public abstract Class Mailer

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.email.PlainMailer
Imports
java.io.File, java.util.Vector, org.apache.tools.ant.BuildException, .Task, org.apache.tools.ant.util.DateUtils

Base class for the various emailing implementations.
Since
Ant 1.5

Field Summary

Modifier and TypeField and Description
protected Vector<EmailAddress>
protected Vector<EmailAddress>
protected Vector<File>
protected EmailAddress
protected Vector<Header>
protected String
private boolean
protected boolean
protected Message
protected String
protected int
private boolean
protected Vector<EmailAddress>
protected boolean
private boolean
protected String
protected Task
protected Vector<EmailAddress>
protected String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final String

Returns:

the current date in SMTP suitable format.
getDate
()

Return the current Date in a format suitable for a SMTP date header.

protected boolean

Returns:

boolean
isPortExplicitlySpecified
()

Whether the port has been explicitly specified by the user.

protected boolean
public abstract void
send()

Send the email.

public void
setBccList(Vector<EmailAddress>
a vector of the bcc addresses.
list
)

Set the bcc addresses.

public void
setCcList(Vector<EmailAddress>
a vector of cc addresses.
list
)

Set the cc addresses.

public void
setEnableStartTLS(boolean
boolean; if true STARTTLS will be supported.
b
)

Set whether to allow authentication to switch to a TLS connection via STARTTLS.

public void
setFiles(Vector<File>
list of files to attach to the email.
files
)

Set the files to attach.

public void
setFrom(EmailAddress
the sender.
from
)

Set the address to send from.

public void
setHeaders(Vector<Header>
a Vector presumed to contain Header objects.
v
)

Set the generic headers to add to the email.

public void
setHost(String
the mail server name.
host
)

Set the mail server.

public void
setIgnoreInvalidRecipients(boolean
boolean
b
)

Whether invalid recipients should be ignored (but a warning will be logged) instead of making the task fail.

public void
setIncludeFileNames(boolean
if true list attached file names in the body content.
b
)

Indicate whether filenames should be listed in the body.

public void
setMessage(Message
the message content.
m
)

Set the message.

public void
setPassword(String
the authentication password.
password
)

Set the password for smtp auth.

public void
setPort(int
the SMTP port.
port
)

Set the smtp port.

public void
setPortExplicitlySpecified(boolean
boolean
explicit
)

Whether the port has been explicitly specified by the user.

public void
setReplyToList(Vector<EmailAddress>
a vector of replyTo addresses.
list
)

Set the replyTo addresses.

public void
setSSL(boolean
if true use SSL transport.
ssl
)

Set whether to send the mail through SSL.

public void
setSubject(String
the subject line.
subject
)

Set the subject.

public void
setTask(Task
the owning task instance.
task
)

Set the owning task.

public void
setToList(Vector<EmailAddress>
a vector of recipient addresses.
list
)

Set the to addresses.

public void
setUser(String
the username.
user
)

Set the user for smtp auth.

protected boolean

Returns:

boolean
shouldIgnoreInvalidRecipients
()

Whether invalid recipients should be ignored.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bccListback to summary
protected Vector<EmailAddress> bccList
ccListback to summary
protected Vector<EmailAddress> ccList
filesback to summary
protected Vector<File> files
fromback to summary
protected EmailAddress from
headersback to summary
protected Vector<Header> headers
hostback to summary
protected String host
ignoreInvalidRecipientsback to summary
private boolean ignoreInvalidRecipients
includeFileNamesback to summary
protected boolean includeFileNames
messageback to summary
protected Message message
passwordback to summary
protected String password
portback to summary
protected int port
portExplicitlySpecifiedback to summary
private boolean portExplicitlySpecified
replyToListback to summary
protected Vector<EmailAddress> replyToList
SSLback to summary
protected boolean SSL
starttlsback to summary
private boolean starttls
subjectback to summary
protected String subject
taskback to summary
protected Task task
toListback to summary
protected Vector<EmailAddress> toList
userback to summary
protected String user

Constructor Detail

Mailerback to summary
public Mailer()

Method Detail

getDateback to summary
protected final String getDate()

Return the current Date in a format suitable for a SMTP date header.

Returns:String

the current date in SMTP suitable format.

Since
Ant 1.5
isPortExplicitlySpecifiedback to summary
protected boolean isPortExplicitlySpecified()

Whether the port has been explicitly specified by the user.

Returns:boolean

boolean

Since
Ant 1.8.2
isStartTLSEnabledback to summary
protected boolean isStartTLSEnabled()
sendback to summary
public abstract void send() throws BuildException

Send the email.

Exceptions
BuildException:
if the email can't be sent.
setBccListback to summary
public void setBccList(Vector<EmailAddress> list)

Set the bcc addresses.

Parameters
list:Vector<EmailAddress>

a vector of the bcc addresses.

setCcListback to summary
public void setCcList(Vector<EmailAddress> list)

Set the cc addresses.

Parameters
list:Vector<EmailAddress>

a vector of cc addresses.

setEnableStartTLSback to summary
public void setEnableStartTLS(boolean b)

Set whether to allow authentication to switch to a TLS connection via STARTTLS.

Parameters
b:boolean

boolean; if true STARTTLS will be supported.

Since
Ant 1.8.0
setFilesback to summary
public void setFiles(Vector<File> files)

Set the files to attach.

Parameters
files:Vector<File>

list of files to attach to the email.

setFromback to summary
public void setFrom(EmailAddress from)

Set the address to send from.

Parameters
from:EmailAddress

the sender.

setHeadersback to summary
public void setHeaders(Vector<Header> v)

Set the generic headers to add to the email.

Parameters
v:Vector<Header>

a Vector presumed to contain Header objects.

Since
Ant 1.7
setHostback to summary
public void setHost(String host)

Set the mail server.

Parameters
host:String

the mail server name.

setIgnoreInvalidRecipientsback to summary
public void setIgnoreInvalidRecipients(boolean b)

Whether invalid recipients should be ignored (but a warning will be logged) instead of making the task fail.

Even with this property set to true the task will still fail if the mail couldn't be sent to any recipient at all.

Parameters
b:boolean

boolean

Since
Ant 1.8.0
setIncludeFileNamesback to summary
public void setIncludeFileNames(boolean b)

Indicate whether filenames should be listed in the body.

Parameters
b:boolean

if true list attached file names in the body content.

setMessageback to summary
public void setMessage(Message m)

Set the message.

Parameters
m:Message

the message content.

setPasswordback to summary
public void setPassword(String password)

Set the password for smtp auth.

Parameters
password:String

the authentication password.

Since
Ant 1.6
setPortback to summary
public void setPort(int port)

Set the smtp port.

Parameters
port:int

the SMTP port.

setPortExplicitlySpecifiedback to summary
public void setPortExplicitlySpecified(boolean explicit)

Whether the port has been explicitly specified by the user.

Parameters
explicit:boolean

boolean

Since
Ant 1.8.2
setReplyToListback to summary
public void setReplyToList(Vector<EmailAddress> list)

Set the replyTo addresses.

Parameters
list:Vector<EmailAddress>

a vector of replyTo addresses.

Since
Ant 1.6
setSSLback to summary
public void setSSL(boolean ssl)

Set whether to send the mail through SSL.

Parameters
ssl:boolean

if true use SSL transport.

Since
Ant 1.6
setSubjectback to summary
public void setSubject(String subject)

Set the subject.

Parameters
subject:String

the subject line.

setTaskback to summary
public void setTask(Task task)

Set the owning task.

Parameters
task:Task

the owning task instance.

setToListback to summary
public void setToList(Vector<EmailAddress> list)

Set the to addresses.

Parameters
list:Vector<EmailAddress>

a vector of recipient addresses.

setUserback to summary
public void setUser(String user)

Set the user for smtp auth.

Parameters
user:String

the username.

Since
Ant 1.6
shouldIgnoreInvalidRecipientsback to summary
protected boolean shouldIgnoreInvalidRecipients()

Whether invalid recipients should be ignored.

Returns:boolean

boolean

Since
Ant 1.8.0