org.apache.tools.ant.taskdefs.email

Class Mailer

public abstract class Mailer extends Object

Base class for the various emailing implementations.

Since: Ant 1.5

Field Summary
protected VectorbccList
protected VectorccList
protected Vectorfiles
protected EmailAddressfrom
protected Stringhost
protected booleanincludeFileNames
protected Messagemessage
protected Stringpassword
protected intport
protected VectorreplyToList
protected Stringsubject
protected booleanSSL
protected Tasktask
protected VectortoList
protected Stringuser
Method Summary
protected StringgetDate()
Returns the current Date in a format suitable for a SMTP date header.
abstract voidsend()
This method should send the email
voidsetBccList(Vector list)
Sets the bcc addresses
voidsetCcList(Vector list)
Sets the cc addresses
voidsetFiles(Vector files)
Sets the files to attach
voidsetFrom(EmailAddress from)
Sets the address to send from
voidsetHost(String host)
Sets the mail server
voidsetIncludeFileNames(boolean b)
Indicates whether filenames should be listed in the body
voidsetMessage(Message m)
Sets the message
voidsetPassword(String password)
Sets the password for smtp auth
voidsetPort(int port)
Sets the smtp port
voidsetReplyToList(Vector list)
Sets the replyto addresses
voidsetSSL(boolean SSL)
Sets whether the user wants to send the mail through SSL
voidsetSubject(String subject)
Sets the subject
voidsetTask(Task task)
Sets the owning task
voidsetToList(Vector list)
Set the to addresses
voidsetUser(String user)
Sets the user for smtp auth

Field Detail

bccList

protected Vector bccList

ccList

protected Vector ccList

files

protected Vector files

from

protected EmailAddress from

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

SSL

protected boolean SSL

task

protected Task task

toList

protected Vector toList

user

protected String user

Method Detail

getDate

protected final String getDate()
Returns 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()
This method should send the email

Throws: BuildException if the email can't be sent.

setBccList

public void setBccList(Vector list)
Sets the bcc addresses

Parameters: list a vector of the bcc addresses

setCcList

public void setCcList(Vector list)
Sets the cc addresses

Parameters: list a vector of cc addresses

setFiles

public void setFiles(Vector files)
Sets the files to attach

Parameters: files list of files to attach to the email.

setFrom

public void setFrom(EmailAddress from)
Sets the address to send from

Parameters: from the sender

setHost

public void setHost(String host)
Sets the mail server

Parameters: host the mail server name

setIncludeFileNames

public void setIncludeFileNames(boolean b)
Indicates 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)
Sets the message

Parameters: m the message content

setPassword

public void setPassword(String password)
Sets the password for smtp auth

Parameters: password the authentication password

Since: ant 1.6

setPort

public void setPort(int port)
Sets the smtp port

Parameters: port the SMTP port

setReplyToList

public void setReplyToList(Vector list)
Sets the replyto addresses

Parameters: list a vector of reployTo addresses

Since: ant 1.6

setSSL

public void setSSL(boolean SSL)
Sets whether the user wants to send the mail through SSL

Parameters: SSL if true use SSL transport

Since: ant 1.6

setSubject

public void setSubject(String subject)
Sets the subject

Parameters: subject the subject line

setTask

public void setTask(Task task)
Sets 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)
Sets the user for smtp auth

Parameters: user the username

Since: ant 1.6

Copyright