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 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()
Returns the current Date in a format suitable for a SMTP date header.
void
send()
This method should send the email
void
setBccList(Vector list)
Sets the bcc addresses
void
setCcList(Vector list)
Sets the cc addresses
void
setFiles(Vector files)
Sets the files to attach
void
setFrom(EmailAddress from)
Sets the address to send from
void
setHost(String host)
Sets the mail server
void
setIncludeFileNames(boolean b)
Indicates whether filenames should be listed in the body
void
setMessage(Message m)
Sets the message
void
setPassword(String password)
Sets the password for smtp auth
void
setPort(int port)
Sets the smtp port
void
setReplyToList(Vector list)
Sets the replyto addresses
void
setSSL(boolean SSL)
Sets whether the user wants to send the mail through SSL
void
setSubject(String subject)
Sets the subject
void
setTask(Task task)
Sets the owning task
void
setToList(Vector list)
Set the to addresses
void
setUser(String user)
Sets 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


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()
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 void send()
            throws BuildException
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 B) 2000-2005 Apache Software Foundation. All Rights Reserved.