Class Mailer
- java.lang.Object
- 
- org.apache.tools.ant.taskdefs.email.Mailer
 
- 
- Direct Known Subclasses:
- MimeMailer
 
 public abstract class Mailer extends java.lang.ObjectBase class for the various emailing implementations.- Since:
- Ant 1.5
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.Vector<EmailAddress>bccListprotected java.util.Vector<EmailAddress>ccListprotected java.util.Vector<java.io.File>filesprotected EmailAddressfromprotected java.util.Vector<Header>headersprotected java.lang.Stringhostprotected booleanincludeFileNamesprotected Messagemessageprotected java.lang.Stringpasswordprotected intportprotected java.util.Vector<EmailAddress>replyToListprotected booleanSSLprotected java.lang.Stringsubjectprotected Tasktaskprotected java.util.Vector<EmailAddress>toListprotected java.lang.Stringuser
 - 
Constructor SummaryConstructors Constructor Description Mailer()
 - 
Method SummaryModifier and Type Method Description protected java.lang.StringgetDate()Return the current Date in a format suitable for a SMTP date header.protected booleanisPortExplicitlySpecified()Whether the port has been explicitly specified by the user.protected booleanisStartTLSEnabled()abstract voidsend()Send the email.voidsetBccList(java.util.Vector<EmailAddress> list)Set the bcc addresses.voidsetCcList(java.util.Vector<EmailAddress> list)Set the cc addresses.voidsetEnableStartTLS(boolean b)Set whether to allow authentication to switch to a TLS connection via STARTTLS.voidsetFiles(java.util.Vector<java.io.File> files)Set the files to attach.voidsetFrom(EmailAddress from)Set the address to send from.voidsetHeaders(java.util.Vector<Header> v)Set the generic headers to add to the email.voidsetHost(java.lang.String host)Set the mail server.voidsetIgnoreInvalidRecipients(boolean b)Whether invalid recipients should be ignored (but a warning will be logged) instead of making the task fail.voidsetIncludeFileNames(boolean b)Indicate whether filenames should be listed in the body.voidsetMessage(Message m)Set the message.voidsetPassword(java.lang.String password)Set the password for smtp auth.voidsetPort(int port)Set the smtp port.voidsetPortExplicitlySpecified(boolean explicit)Whether the port has been explicitly specified by the user.voidsetReplyToList(java.util.Vector<EmailAddress> list)Set the replyTo addresses.voidsetSSL(boolean ssl)Set whether to send the mail through SSL.voidsetSubject(java.lang.String subject)Set the subject.voidsetTask(Task task)Set the owning task.voidsetToList(java.util.Vector<EmailAddress> list)Set the to addresses.voidsetUser(java.lang.String user)Set the user for smtp auth.protected booleanshouldIgnoreInvalidRecipients()Whether invalid recipients should be ignored.
 
- 
- 
- 
Field Detail- 
hostprotected java.lang.String host 
 - 
portprotected int port 
 - 
userprotected java.lang.String user 
 - 
passwordprotected java.lang.String password 
 - 
SSLprotected boolean SSL 
 - 
messageprotected Message message 
 - 
fromprotected EmailAddress from 
 - 
replyToListprotected java.util.Vector<EmailAddress> replyToList 
 - 
toListprotected java.util.Vector<EmailAddress> toList 
 - 
ccListprotected java.util.Vector<EmailAddress> ccList 
 - 
bccListprotected java.util.Vector<EmailAddress> bccList 
 - 
filesprotected java.util.Vector<java.io.File> files 
 - 
subjectprotected java.lang.String subject 
 - 
taskprotected Task task 
 - 
includeFileNamesprotected boolean includeFileNames 
 - 
headersprotected java.util.Vector<Header> headers 
 
- 
 - 
Method Detail- 
setHostpublic void setHost(java.lang.String host) Set the mail server.- Parameters:
- host- the mail server name.
 
 - 
setPortpublic void setPort(int port) Set the smtp port.- Parameters:
- port- the SMTP port.
 
 - 
setPortExplicitlySpecifiedpublic void setPortExplicitlySpecified(boolean explicit) Whether the port has been explicitly specified by the user.- Parameters:
- explicit- boolean
- Since:
- Ant 1.8.2
 
 - 
isPortExplicitlySpecifiedprotected boolean isPortExplicitlySpecified() Whether the port has been explicitly specified by the user.- Returns:
- boolean
- Since:
- Ant 1.8.2
 
 - 
setUserpublic void setUser(java.lang.String user) Set the user for smtp auth.- Parameters:
- user- the username.
- Since:
- Ant 1.6
 
 - 
setPasswordpublic void setPassword(java.lang.String password) Set the password for smtp auth.- Parameters:
- password- the authentication password.
- Since:
- Ant 1.6
 
 - 
setSSLpublic void setSSL(boolean ssl) Set whether to send the mail through SSL.- Parameters:
- ssl- if true use SSL transport.
- Since:
- Ant 1.6
 
 - 
setEnableStartTLSpublic void setEnableStartTLS(boolean b) Set whether to allow authentication to switch to a TLS connection via STARTTLS.- Parameters:
- b- boolean; if true STARTTLS will be supported.
- Since:
- Ant 1.8.0
 
 - 
isStartTLSEnabledprotected boolean isStartTLSEnabled() 
 - 
setMessagepublic void setMessage(Message m) Set the message.- Parameters:
- m- the message content.
 
 - 
setFrompublic void setFrom(EmailAddress from) Set the address to send from.- Parameters:
- from- the sender.
 
 - 
setReplyToListpublic void setReplyToList(java.util.Vector<EmailAddress> list) Set the replyTo addresses.- Parameters:
- list- a vector of replyTo addresses.
- Since:
- Ant 1.6
 
 - 
setToListpublic void setToList(java.util.Vector<EmailAddress> list) Set the to addresses.- Parameters:
- list- a vector of recipient addresses.
 
 - 
setCcListpublic void setCcList(java.util.Vector<EmailAddress> list) Set the cc addresses.- Parameters:
- list- a vector of cc addresses.
 
 - 
setBccListpublic void setBccList(java.util.Vector<EmailAddress> list) Set the bcc addresses.- Parameters:
- list- a vector of the bcc addresses.
 
 - 
setFilespublic void setFiles(java.util.Vector<java.io.File> files) Set the files to attach.- Parameters:
- files- list of files to attach to the email.
 
 - 
setSubjectpublic void setSubject(java.lang.String subject) Set the subject.- Parameters:
- subject- the subject line.
 
 - 
setTaskpublic void setTask(Task task) Set the owning task.- Parameters:
- task- the owning task instance.
 
 - 
setIncludeFileNamespublic 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.
 
 - 
setHeaderspublic void setHeaders(java.util.Vector<Header> v) Set the generic headers to add to the email.- Parameters:
- v- a Vector presumed to contain Header objects.
- Since:
- Ant 1.7
 
 - 
sendpublic abstract void send() throws BuildExceptionSend the email.- Throws:
- BuildException- if the email can't be sent.
 
 - 
setIgnoreInvalidRecipientspublic 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
- Since:
- Ant 1.8.0
 
 - 
shouldIgnoreInvalidRecipientsprotected boolean shouldIgnoreInvalidRecipients() Whether invalid recipients should be ignored.- Returns:
- boolean
- Since:
- Ant 1.8.0
 
 - 
getDateprotected final java.lang.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
 
 
- 
 
-