A task to send SMTP email. This is a refactoring of the SendMail and
MimeMail tasks such that both are within a single task.
addBcc
public void addBcc(EmailAddress address)
Add a "bcc" address element.
address
- The email address.
addCc
public void addCc(EmailAddress address)
Add a "cc" address element.
address
- The email address.
addFileset
public void addFileset(FileSet fs)
Add a set of files (nested fileset attribute).
addFrom
public void addFrom(EmailAddress address)
Add a from address element.
address
- The address to send from.
addMessage
public void addMessage(Message message)
throws BuildException
Add a message element.
message
- The message object.
addReplyTo
public void addReplyTo(EmailAddress address)
Add a replyto address element.
address
- The address to reply to.
addTo
public void addTo(EmailAddress address)
Add a to address element.
address
- An email address.
createAttachments
public Path createAttachments()
Creates a Path as container for attachments. Supports any
filesystem resource-collections that way.
- the path to be configured.
createHeader
public Header createHeader()
Create a nested header element.
execute
public void execute()
Send an email.
- execute in interface Task
getCharset
public String getCharset()
Returns the character set of mail message.
getIncludeFileNames
public boolean getIncludeFileNames()
Get whether file names should be included.
- Identifies whether file names should be included.
setBccList
public void setBccList(String list)
Shorthand to set the "bcc" address element.
list
- comma separated list of addresses.
setCcList
public void setCcList(String list)
Shorthand to set the "cc" address element.
list
- Comma separated list of addresses.
setCharset
public void setCharset(String charset)
Sets the character set of mail message.
Will be ignored if mimeType contains ....; Charset=... substring or
encoding is not a mime
.
charset
- the character encoding to use.
setEncoding
public void setEncoding(EmailTask.Encoding encoding)
Set the preferred encoding method.
encoding
- The encoding (one of AUTO, MIME, UU, PLAIN).
setFailOnError
public void setFailOnError(boolean failOnError)
Set whether BuildExceptions should be passed back to the core.
failOnError
- The new FailOnError value.
setFiles
public void setFiles(String filenames)
Set the list of files to be attached.
filenames
- Comma-separated list of files.
setFrom
public void setFrom(String address)
Shorthand to set the from address element.
address
- The address to send mail from.
setIncludefilenames
public void setIncludefilenames(boolean includeFileNames)
Set whether to include filenames.
includeFileNames
- Whether to include filenames in the text of the
message.
setMailhost
public void setMailhost(String host)
Set the host.
host
- The host to connect to.
setMailport
public void setMailport(int port)
Set the mail server port.
setMessage
public void setMessage(String message)
Shorthand method to set the message.
message
- Message body of this email.
setMessageFile
public void setMessageFile(File file)
Shorthand method to set the message from a file.
file
- The file from which to take the message.
setMessageMimeType
public void setMessageMimeType(String type)
Shorthand method to set type of the text message, text/plain by default
but text/html or text/xml is quite feasible.
type
- The new MessageMimeType value.
setPassword
public void setPassword(String password)
Set the password for SMTP auth; this requires JavaMail.
password
- the String password.
setReplyTo
public void setReplyTo(String address)
Shorthand to set the replyto address element.
address
- The address to which replies should be directed.
setSSL
public void setSSL(boolean ssl)
Set whether to send data over SSL.
ssl
- boolean; if true SSL will be used.
setSubject
public void setSubject(String subject)
Set the subject line of the email.
subject
- Subject of this email.
setToList
public void setToList(String list)
Shorthand to set the "to" address element.
list
- Comma-separated list of addresses.
setUser
public void setUser(String user)
Set the user for SMTP auth; this requires JavaMail.
user
- the String username.