Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs.email
Class EmailTask

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.email.EmailTask

Direct Known Subclasses:
  MimeMail, SendEmail

public class EmailTask
extends Task

A task to send SMTP email. This is a refactoring of the SendMail and MimeMail tasks such that both are within a single task.

Since:
  Ant 1.5
Author:
  Magesh Umasankar, glenn_twiggs@bmc.com, steve_l@iseran.com steve loughran, ehatcher@apache.org Erik Hatcher, paulo.gaspar@krankikom.de Paulo Gaspar, roxspring@imapmail.org Rob Oxspring

Nested Class Summary
`static class` | `EmailTask.Encoding` Enumerates the encoding constants

Field Summary
`static java.lang.String` | `AUTO` Constant to show that the best available mailer should be used.
`static java.lang.String` | `MIME` Constant to allow the Mime mailer to be requested
`static java.lang.String` | `PLAIN` Constant to allow the plaintext mailer to be requested
`static java.lang.String` | `UU` Constant to allow the UU mailer to be requested

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`EmailTask()`

Method Summary
`void` | `addBcc(EmailAddress address)` Adds "bcc" address elements
`void` | `addCc(EmailAddress address)` Adds "cc" address element
`void` | `addFileset(FileSet fs)` Adds a set of files (nested fileset attribute).
`void` | `addFrom(EmailAddress address)` Adds a from address element
`void` | `addMessage(Message message)` Add a message elemnt
`void` | `addTo(EmailAddress address)` Adds a to address element
`void` | `execute()` Sends an email
`boolean` | `getIncludeFileNames()` Identifies whether file names should be included
`void` | `setBccList(java.lang.String list)` Adds "bcc" address elements
`void` | `setCcList(java.lang.String list)` Adds "cc" address elements
`void` | `setEncoding(EmailTask.Encoding encoding)` Allows the build writer to choose the preferred encoding method
`void` | `setFailOnError(boolean failOnError)` Indicates whether BuildExceptions should be passed back to the core
`void` | `setFiles(java.lang.String filenames)` Adds a list of files to be attached
`void` | `setFrom(java.lang.String address)` Shorthand to set the from address element
`void` | `setIncludefilenames(boolean includeFileNames)` Sets Includefilenames attribute
`void` | `setMailhost(java.lang.String host)` Sets the host
`void` | `setMailport(int port)` Sets the mail server port
`void` | `setMessage(java.lang.String message)` Shorthand method to set the message
`void` | `setMessageFile(java.io.File file)` Shorthand method to set the message from a file
`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.
`void` | `setSubject(java.lang.String subject)` Sets the subject line of the email
`void` | `setToList(java.lang.String list)` Adds "to" address elements

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### AUTO

    public static final java.lang.String AUTO

  Constant to show that the best available mailer should be used.

  See Also:
    Constant Field Values

### MIME

    public static final java.lang.String MIME

  Constant to allow the Mime mailer to be requested

  See Also:
    Constant Field Values

### UU

    public static final java.lang.String UU

  Constant to allow the UU mailer to be requested

  See Also:
    Constant Field Values

### PLAIN

    public static final java.lang.String PLAIN

  Constant to allow the plaintext mailer to be requested

  See Also:
    Constant Field Values

Constructor Detail

### EmailTask

    public EmailTask()

Method Detail

### setEncoding

    public void setEncoding(EmailTask.Encoding encoding)

  Allows the build writer to choose the preferred encoding method

  Parameters:
    `encoding` - The encoding (one of AUTO,MIME,UU,PLAIN)

### setMailport

    public void setMailport(int port)

  Sets the mail server port

  Parameters:
    `port` - The port to use

### setMailhost

    public void setMailhost(java.lang.String host)

  Sets the host

  Parameters:
    `host` - The host to connect to

### setSubject

    public void setSubject(java.lang.String subject)

  Sets the subject line of the email

  Parameters:
    `subject` - Subject of this email.

### setMessage

    public void setMessage(java.lang.String message)

  Shorthand method to set the message

  Parameters:
    `message` - Message body of this email.

### setMessageFile

    public 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

### setMessageMimeType

    public 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

### addMessage

    public void addMessage(Message message)
                    throws BuildException

  Add a message elemnt

  Parameters:
    `message` - The message object
  Throws:
    `BuildException` - if a message has already been added

### addFrom

    public void addFrom(EmailAddress address)

  Adds a from address element

  Parameters:
    `address` - The address to send from

### setFrom

    public void setFrom(java.lang.String address)

  Shorthand to set the from address element

  Parameters:
    `address` - The address to send mail from

### addTo

    public void addTo(EmailAddress address)

  Adds a to address element

  Parameters:
    `address` - An email address

### setToList

    public void setToList(java.lang.String list)

  Adds "to" address elements

  Parameters:
    `list` - Comma separated list of addresses

### addCc

    public void addCc(EmailAddress address)

  Adds "cc" address element

  Parameters:
    `address` - The email address

### setCcList

    public void setCcList(java.lang.String list)

  Adds "cc" address elements

  Parameters:
    `list` - Comma separated list of addresses

### addBcc

    public void addBcc(EmailAddress address)

  Adds "bcc" address elements

  Parameters:
    `address` - The email address

### setBccList

    public void setBccList(java.lang.String list)

  Adds "bcc" address elements

  Parameters:
    `list` - comma separated list of addresses

### setFailOnError

    public void setFailOnError(boolean failOnError)

  Indicates whether BuildExceptions should be passed back to the core

  Parameters:
    `failOnError` - The new FailOnError value

### setFiles

    public void setFiles(java.lang.String filenames)

  Adds a list of files to be attached

  Parameters:
    `filenames` - Comma separated list of files

### addFileset

    public void addFileset(FileSet fs)

  Adds a set of files (nested fileset attribute).

  Parameters:
    `fs` - The fileset

### setIncludefilenames

    public void setIncludefilenames(boolean includeFileNames)

  Sets Includefilenames attribute

  Parameters:
    `includeFileNames` - Whether to include filenames in the text of the message

### getIncludeFileNames

    public boolean getIncludeFileNames()

  Identifies whether file names should be included

  Returns:
    Identifies whether file names should be included

### execute

    public void execute()

  Sends an email

  Overrides:
    `execute` in class `Task`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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