org.apache.tools.ant.taskdefs.email

Class Mailer

Known Direct Subclasses:
MimeMailer

public abstract class Mailer
extends java.lang.Object

Base class for the various emailing implementations.
Since:
Ant 1.5

Field Summary

protected boolean
SSL
protected Vector
bccList
protected Vector
ccList
protected Vector
files
protected EmailAddress
from
protected Vector
headers
protected String
host
protected boolean
includeFileNames
protected Message
message
protected String
password
protected int
port
protected Vector
replyToList
protected String
subject
protected Task
task
protected Vector
toList
protected String
user

Method Summary

protected String
getDate()
Return the current Date in a format suitable for a SMTP date header.
abstract void
send()
Send the email.
void
setBccList(Vector list)
Set the bcc addresses.
void
setCcList(Vector list)
Set the cc addresses.
void
setFiles(Vector files)
Set the files to attach.
void
setFrom(EmailAddress from)
Set the address to send from.
void
setHeaders(Vector v)
Set the generic headers to add to the email.
void
setHost(String host)
Set the mail server.
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
setReplyToList(Vector 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 list)
Set the to addresses.
void
setUser(String user)
Set the user for smtp auth.

Field Details

SSL

protected boolean SSL

bccList

protected Vector bccList

ccList

protected Vector ccList

files

protected Vector files

from

protected EmailAddress from

headers

protected Vector headers

host

protected String host

includeFileNames

protected boolean includeFileNames

message

protected Message message

password

protected String password

port

protected int port

replyToList

protected Vector replyToList

subject

protected String subject

task

protected Task task

toList

protected Vector toList

user

protected String user

Method Details

getDate

protected final String getDate()
Return the current Date in a format suitable for a SMTP date header.
Returns:
the current date in SMTP suitable format.
Since:
Ant 1.5

send

public abstract void send()
            throws BuildException
Send the email.
Throws:
BuildException - if the email can't be sent.

setBccList

public void setBccList(Vector list)
Set the bcc addresses.
Parameters:
list - a vector of the bcc addresses.

setCcList

public void setCcList(Vector list)
Set the cc addresses.
Parameters:
list - a vector of cc addresses.

setFiles

public void setFiles(Vector files)
Set the files to attach.
Parameters:
files - list of files to attach to the email.

setFrom

public void setFrom(EmailAddress from)
Set the address to send from.
Parameters:
from - the sender.

setHeaders

public void setHeaders(Vector v)
Set the generic headers to add to the email.
Parameters:
v - a Vector presumed to contain Header objects.
Since:
Ant 1.7

setHost

public void setHost(String host)
Set the mail server.
Parameters:
host - the mail server name.

setIncludeFileNames

public void setIncludeFileNames(boolean b)
Indicate whether filenames should be listed in the body.
Parameters:
b - if true list attached file names in the body content.

setMessage

public void setMessage(Message m)
Set the message.
Parameters:
m - the message content.

setPassword

public void setPassword(String password)
Set the password for smtp auth.
Parameters:
password - the authentication password.
Since:
Ant 1.6

setPort

public void setPort(int port)
Set the smtp port.
Parameters:
port - the SMTP port.

setReplyToList

public void setReplyToList(Vector list)
Set the replyto addresses.
Parameters:
list - a vector of reployTo addresses.
Since:
Ant 1.6

setSSL

public void setSSL(boolean ssl)
Set whether to send the mail through SSL.
Parameters:
ssl - if true use SSL transport.
Since:
Ant 1.6

setSubject

public void setSubject(String subject)
Set the subject.
Parameters:
subject - the subject line.

setTask

public void setTask(Task task)
Set the owning task.
Parameters:
task - the owning task instance.

setToList

public void setToList(Vector list)
Set the to addresses.
Parameters:
list - a vector of recipient addresses.

setUser

public void setUser(String user)
Set the user for smtp auth.
Parameters:
user - the username.
Since:
Ant 1.6