Class EmailTask
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.email.EmailTask
 
 
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classEmailTask.EncodingEnumerates the encoding constants.
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringAUTOConstant to show that the best available mailer should be used.static java.lang.StringMIMEConstant to allow the Mime mailer to be requestedstatic java.lang.StringPLAINConstant to allow the plaintext mailer to be requestedstatic java.lang.StringUUConstant to allow the UU mailer to be requested- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description EmailTask()
 - 
Method SummaryModifier and Type Method Description voidaddBcc(EmailAddress address)Add a "bcc" address element.voidaddCc(EmailAddress address)Add a "cc" address element.voidaddFileset(FileSet fs)Add a set of files (nested fileset attribute).voidaddFrom(EmailAddress address)Add a from address element.voidaddMessage(Message message)Add a message element.voidaddReplyTo(EmailAddress address)Add a replyto address element.voidaddTo(EmailAddress address)Add a to address element.PathcreateAttachments()Creates a Path as container for attachments.HeadercreateHeader()Create a nested header element.voidexecute()Send an email.java.lang.StringgetCharset()Returns the character set of mail message.booleangetIncludeFileNames()Get whether file names should be included.voidsetBccList(java.lang.String list)Shorthand to set the "bcc" address element.voidsetCcList(java.lang.String list)Shorthand to set the "cc" address element.voidsetCharset(java.lang.String charset)Sets the character set of mail message.voidsetEnableStartTLS(boolean b)Set whether to allow authentication to switch to a TLS connection via STARTTLS.voidsetEncoding(EmailTask.Encoding encoding)Set the preferred encoding method.voidsetFailOnError(boolean failOnError)Set whether BuildExceptions should be passed back to the core.voidsetFiles(java.lang.String filenames)Set the list of files to be attached.voidsetFrom(java.lang.String address)Shorthand to set the from address element.voidsetIgnoreInvalidRecipients(boolean b)Whether invalid recipients should be ignored (but a warning will be logged) instead of making the task fail.voidsetIncludefilenames(boolean includeFileNames)Set whether to include filenames.voidsetMailhost(java.lang.String host)Set the host.voidsetMailport(int port)Set the mail server port.voidsetMessage(java.lang.String message)Shorthand method to set the message.voidsetMessageFile(java.io.File file)Shorthand method to set the message from a file.voidsetMessageFileInputEncoding(java.lang.String encoding)Sets the encoding to expect when reading the message from a file.voidsetMessageMimeType(java.lang.String type)Shorthand method to set type of the text message, text/plain by default but text/html or text/xml is quite feasible.voidsetPassword(java.lang.String password)Set the password for SMTP auth; this requires JavaMail.voidsetReplyTo(java.lang.String address)Shorthand to set the replyto address element.voidsetSSL(boolean ssl)Set whether to send data over SSL.voidsetSubject(java.lang.String subject)Set the subject line of the email.voidsetToList(java.lang.String list)Shorthand to set the "to" address element.voidsetUser(java.lang.String user)Set the user for SMTP auth; this requires JavaMail.- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Field Detail- 
AUTOpublic static final java.lang.String AUTO Constant to show that the best available mailer should be used.- See Also:
- Constant Field Values
 
 - 
MIMEpublic static final java.lang.String MIME Constant to allow the Mime mailer to be requested- See Also:
- Constant Field Values
 
 - 
UUpublic static final java.lang.String UU Constant to allow the UU mailer to be requested- See Also:
- Constant Field Values
 
 - 
PLAINpublic static final java.lang.String PLAIN Constant to allow the plaintext mailer to be requested- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setUserpublic void setUser(java.lang.String user) Set the user for SMTP auth; this requires JavaMail.- Parameters:
- user- the String username.
- Since:
- Ant 1.6
 
 - 
setPasswordpublic void setPassword(java.lang.String password) Set the password for SMTP auth; this requires JavaMail.- Parameters:
- password- the String password.
- Since:
- Ant 1.6
 
 - 
setSSLpublic void setSSL(boolean ssl) Set whether to send data over SSL.- Parameters:
- ssl- boolean; if true SSL will be used.
- 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
 
 - 
setEncodingpublic void setEncoding(EmailTask.Encoding encoding) Set the preferred encoding method.- Parameters:
- encoding- The encoding (one of AUTO, MIME, UU, PLAIN).
 
 - 
setMailportpublic void setMailport(int port) Set the mail server port.- Parameters:
- port- The port to use.
 
 - 
setMailhostpublic void setMailhost(java.lang.String host) Set the host.- Parameters:
- host- The host to connect to.
 
 - 
setSubjectpublic void setSubject(java.lang.String subject) Set the subject line of the email.- Parameters:
- subject- Subject of this email.
 
 - 
setMessagepublic void setMessage(java.lang.String message) Shorthand method to set the message.- Parameters:
- message- Message body of this email.
 
 - 
setMessageFilepublic void setMessageFile(java.io.File file) Shorthand method to set the message from a file.- Parameters:
- file- The file from which to take the message.
 
 - 
setMessageMimeTypepublic void setMessageMimeType(java.lang.String type) Shorthand method to set type of the text message, text/plain by default but text/html or text/xml is quite feasible.- Parameters:
- type- The new MessageMimeType value.
 
 - 
addMessagepublic void addMessage(Message message) throws BuildException Add a message element.- Parameters:
- message- The message object.
- Throws:
- BuildException- if a message has already been added.
 
 - 
addFrompublic void addFrom(EmailAddress address) Add a from address element.- Parameters:
- address- The address to send from.
 
 - 
setFrompublic void setFrom(java.lang.String address) Shorthand to set the from address element.- Parameters:
- address- The address to send mail from.
 
 - 
addReplyTopublic void addReplyTo(EmailAddress address) Add a replyto address element.- Parameters:
- address- The address to reply to.
- Since:
- Ant 1.6
 
 - 
setReplyTopublic void setReplyTo(java.lang.String address) Shorthand to set the replyto address element.- Parameters:
- address- The address to which replies should be directed.
- Since:
- Ant 1.6
 
 - 
addTopublic void addTo(EmailAddress address) Add a to address element.- Parameters:
- address- An email address.
 
 - 
setToListpublic void setToList(java.lang.String list) Shorthand to set the "to" address element.- Parameters:
- list- Comma-separated list of addresses.
 
 - 
addCcpublic void addCc(EmailAddress address) Add a "cc" address element.- Parameters:
- address- The email address.
 
 - 
setCcListpublic void setCcList(java.lang.String list) Shorthand to set the "cc" address element.- Parameters:
- list- Comma separated list of addresses.
 
 - 
addBccpublic void addBcc(EmailAddress address) Add a "bcc" address element.- Parameters:
- address- The email address.
 
 - 
setBccListpublic void setBccList(java.lang.String list) Shorthand to set the "bcc" address element.- Parameters:
- list- comma separated list of addresses.
 
 - 
setFailOnErrorpublic void setFailOnError(boolean failOnError) Set whether BuildExceptions should be passed back to the core.- Parameters:
- failOnError- The new FailOnError value.
 
 - 
setFilespublic void setFiles(java.lang.String filenames) Set the list of files to be attached.- Parameters:
- filenames- Comma-separated list of files.
 
 - 
addFilesetpublic void addFileset(FileSet fs) Add a set of files (nested fileset attribute).- Parameters:
- fs- The fileset.
 
 - 
createAttachmentspublic Path createAttachments() Creates a Path as container for attachments. Supports any filesystem resource-collections that way.- Returns:
- the path to be configured.
- Since:
- Ant 1.7
 
 - 
createHeaderpublic Header createHeader() Create a nested header element.- Returns:
- a Header instance.
 
 - 
setIncludefilenamespublic void setIncludefilenames(boolean includeFileNames) Set whether to include filenames.- Parameters:
- includeFileNames- Whether to include filenames in the text of the message.
 
 - 
getIncludeFileNamespublic boolean getIncludeFileNames() Get whether file names should be included.- Returns:
- Identifies whether file names should be included.
 
 - 
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
 
 - 
setCharsetpublic void setCharset(java.lang.String charset) Sets the character set of mail message. Will be ignored if mimeType contains ....; Charset=... substring or encoding is notmime.- Parameters:
- charset- the character encoding to use.
- Since:
- Ant 1.6
 
 - 
getCharsetpublic java.lang.String getCharset() Returns the character set of mail message.- Returns:
- Charset of mail message.
- Since:
- Ant 1.6
 
 - 
setMessageFileInputEncodingpublic void setMessageFileInputEncoding(java.lang.String encoding) Sets the encoding to expect when reading the message from a file.Will be ignored if the message has been specified inline. - Parameters:
- encoding- the name of the charset used
- Since:
- Ant 1.9.4
 
 
- 
 
-