Class Mailer
java.lang.Object
org.apache.tools.ant.taskdefs.email.Mailer
- Direct Known Subclasses:
- JakartaMimeMailer,- MimeMailer
Base class for the various emailing implementations.
- Since:
- Ant 1.5
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Vector<EmailAddress> protected Vector<EmailAddress> protected EmailAddressprotected Stringprotected booleanprotected Messageprotected Stringprotected intprotected Vector<EmailAddress> protected booleanprotected Stringprotected Taskprotected Vector<EmailAddress> protected String
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected final StringgetDate()Return the current Date in a format suitable for a SMTP date header.protected booleanWhether the port has been explicitly specified by the user.protected booleanabstract voidsend()Send the email.voidsetBccList(Vector<EmailAddress> list) Set the bcc addresses.voidsetCcList(Vector<EmailAddress> list) Set the cc addresses.voidsetEnableStartTLS(boolean b) Set whether to allow authentication to switch to a TLS connection via STARTTLS.voidSet the files to attach.voidsetFrom(EmailAddress from) Set the address to send from.voidsetHeaders(Vector<Header> v) Set the generic headers to add to the email.voidSet 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.voidSet the message.voidsetPassword(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(Vector<EmailAddress> list) Set the replyTo addresses.voidsetSSL(boolean ssl) Set whether to send the mail through SSL.voidsetSubject(String subject) Set the subject.voidSet the owning task.voidsetToList(Vector<EmailAddress> list) Set the to addresses.voidSet the user for smtp auth.protected booleanWhether invalid recipients should be ignored.
- 
Field Details- 
host
- 
portprotected int port
- 
user
- 
password
- 
SSLprotected boolean SSL
- 
message
- 
from
- 
replyToList
- 
toList
- 
ccList
- 
bccList
- 
files
- 
subject
- 
task
- 
includeFileNamesprotected boolean includeFileNames
- 
headers
 
- 
- 
Constructor Details- 
Mailerpublic Mailer()
 
- 
- 
Method Details- 
setHost
- 
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
 
- 
setUserSet the user for smtp auth.- Parameters:
- user- the username.
- Since:
- Ant 1.6
 
- 
setPasswordSet 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()
- 
setMessage
- 
setFrom
- 
setReplyToListSet the replyTo addresses.- Parameters:
- list- a vector of replyTo addresses.
- Since:
- Ant 1.6
 
- 
setToListSet the to addresses.- Parameters:
- list- a vector of recipient addresses.
 
- 
setCcListSet the cc addresses.- Parameters:
- list- a vector of cc addresses.
 
- 
setBccListSet the bcc addresses.- Parameters:
- list- a vector of the bcc addresses.
 
- 
setFiles
- 
setSubject
- 
setTask
- 
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.
 
- 
setHeaders
- 
sendSend 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
 
- 
getDateReturn the current Date in a format suitable for a SMTP date header.- Returns:
- the current date in SMTP suitable format.
- Since:
- Ant 1.5
 
 
-