org.apache.tools.ant.taskdefs.email
Class Mailer

java.lang.Object
  |
  +--org.apache.tools.ant.taskdefs.email.Mailer
Direct Known Subclasses:
MimeMailer

public abstract class Mailer
extends java.lang.Object

Base class for the various emailing implementations.

Since:
Ant 1.5

Field Summary
protected  java.util.Vector bccList
           
protected  java.util.Vector ccList
           
protected  java.util.Vector files
           
protected  EmailAddress from
           
protected  java.lang.String host
           
protected  boolean includeFileNames
           
protected  Message message
           
protected  java.lang.String password
           
protected  int port
           
protected  java.util.Vector replyToList
           
protected  boolean SSL
           
protected  java.lang.String subject
           
protected  Task task
           
protected  java.util.Vector toList
           
protected  java.lang.String user
           
 
Constructor Summary
Mailer()
           
 
Method Summary
protected  java.lang.String getDate()
          Returns the current Date in a format suitable for a SMTP date header.
abstract  void send()
          This method should send the email
 void setBccList(java.util.Vector list)
          Sets the bcc addresses
 void setCcList(java.util.Vector list)
          Sets the cc addresses
 void setFiles(java.util.Vector files)
          Sets the files to attach
 void setFrom(EmailAddress from)
          Sets the address to send from
 void setHost(java.lang.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(java.lang.String password)
          Sets the password for smtp auth
 void setPort(int port)
          Sets the smtp port
 void setReplyToList(java.util.Vector list)
          Sets the replyto addresses
 void setSSL(boolean SSL)
          Sets whether the user wants to send the mail through SSL
 void setSubject(java.lang.String subject)
          Sets the subject
 void setTask(Task task)
          Sets the owning task
 void setToList(java.util.Vector list)
          Set the to addresses
 void setUser(java.lang.String user)
          Sets the user for smtp auth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

protected java.lang.String host

port

protected int port

user

protected java.lang.String user

password

protected java.lang.String password

SSL

protected boolean SSL

message

protected Message message

from

protected EmailAddress from

replyToList

protected java.util.Vector replyToList

toList

protected java.util.Vector toList

ccList

protected java.util.Vector ccList

bccList

protected java.util.Vector bccList

files

protected java.util.Vector files

subject

protected java.lang.String subject

task

protected Task task

includeFileNames

protected boolean includeFileNames
Constructor Detail

Mailer

public Mailer()
Method Detail

setHost

public void setHost(java.lang.String host)
Sets the mail server

Parameters:
host - the mail server name

setPort

public void setPort(int port)
Sets the smtp port

Parameters:
port - the SMTP port

setUser

public void setUser(java.lang.String user)
Sets the user for smtp auth

Parameters:
user - the username
Since:
ant 1.6

setPassword

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

Parameters:
password - the authentication password
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

setMessage

public void setMessage(Message m)
Sets the message

Parameters:
m - the message content

setFrom

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

Parameters:
from - the sender

setReplyToList

public void setReplyToList(java.util.Vector list)
Sets the replyto addresses

Parameters:
list - a vector of reployTo addresses
Since:
ant 1.6

setToList

public void setToList(java.util.Vector list)
Set the to addresses

Parameters:
list - a vector of recipient addresses

setCcList

public void setCcList(java.util.Vector list)
Sets the cc addresses

Parameters:
list - a vector of cc addresses

setBccList

public void setBccList(java.util.Vector list)
Sets the bcc addresses

Parameters:
list - a vector of the bcc addresses

setFiles

public void setFiles(java.util.Vector files)
Sets the files to attach

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

setSubject

public void setSubject(java.lang.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

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.

send

public abstract void send()
                   throws BuildException
This method should send the email

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

getDate

protected final java.lang.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


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.