org.apache.tools.ant.taskdefs.optional.net
Class MimeMail

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.optional.net.MimeMail

public class MimeMail
extends Task

A task to send SMTP email. This version has near identical syntax to the SendEmail task, but is MIME aware. It also requires Sun's mail.jar and activation.jar to compile and execute, which puts it clearly into the very optional category.

Author:
glenn_twiggs@bmc.com, steve_l@iseran.com steve loughran, erik@hatcher.net Erik Hatcher, paulo.gaspar@krankikom.de Paulo Gaspar

Field Summary
protected  java.lang.String bccList
          BCC (Blind Carbon Copy) recipients
protected  java.lang.String ccList
          CC (Carbon Copy) recipients
 
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
MimeMail()
          Creates new instance
 
Method Summary
 void addFileset(FileSet set)
          Adds a set of files (nested fileset attribute).
 void doMail()
          here is where the mail is sent
 void execute()
          Executes this build task. throws org.apache.tools.ant.BuildException if there is an error during task execution.
 void setBccList(java.lang.String bccList)
          Sets the toList parameter of this build task.
 void setCcList(java.lang.String ccList)
          Sets the toList parameter of this build task.
 void setFailOnError(boolean failOnError)
          Sets the FailOnError attribute of the MimeMail object
 void setFrom(java.lang.String from)
          Sets the "from" parameter of this build task.
 void setMailhost(java.lang.String mailhost)
          Sets the mailhost parameter of this build task.
 void setMessage(java.lang.String message)
          Sets the message parameter of this build task.
 void setMessageFile(java.io.File messageFile)
           
 void setMessageMimeType(java.lang.String type)
          set type of the text message, plaintext by default but text/html or text/xml is quite feasible
 void setSubject(java.lang.String subject)
          Sets the subject parameter of this build task.
 void setToList(java.lang.String toList)
          Sets the toList parameter of this build task.
 void validate()
          verify parameters
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, 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

ccList

protected java.lang.String ccList
CC (Carbon Copy) recipients

bccList

protected java.lang.String bccList
BCC (Blind Carbon Copy) recipients
Constructor Detail

MimeMail

public MimeMail()
Creates new instance
Method Detail

setFailOnError

public void setFailOnError(boolean failOnError)
Sets the FailOnError attribute of the MimeMail object
Parameters:
failOnError - The new FailOnError value

addFileset

public void addFileset(FileSet set)
Adds a set of files (nested fileset attribute).

setToList

public void setToList(java.lang.String toList)
Sets the toList parameter of this build task.
Parameters:
toList - Comma-separated list of email recipient addreses.

setCcList

public void setCcList(java.lang.String ccList)
Sets the toList parameter of this build task.
Parameters:
toList - Comma-separated list of email recipient addreses.

setBccList

public void setBccList(java.lang.String bccList)
Sets the toList parameter of this build task.
Parameters:
toList - Comma-separated list of email recipient addreses.

setFrom

public void setFrom(java.lang.String from)
Sets the "from" parameter of this build task.
Parameters:
from - Email address of sender.

setMailhost

public void setMailhost(java.lang.String mailhost)
Sets the mailhost parameter of this build task.
Parameters:
mailhost - Mail host name.

setMessage

public void setMessage(java.lang.String message)
Sets the message parameter of this build task.
Parameters:
message - Message body of this email.

setMessageFile

public void setMessageFile(java.io.File messageFile)

setMessageMimeType

public void setMessageMimeType(java.lang.String type)
set type of the text message, plaintext by default but text/html or text/xml is quite feasible
Parameters:
type - The new MessageMimeType value

setSubject

public void setSubject(java.lang.String subject)
Sets the subject parameter of this build task.
Parameters:
subject - Subject of this email.

validate

public void validate()
verify parameters
Throws:
BuildException - if something is invalid

execute

public void execute()
             throws BuildException
Executes this build task. throws org.apache.tools.ant.BuildException if there is an error during task execution.
Overrides:
execute in class Task
Throws:
BuildException - Description of Exception

doMail

public void doMail()
            throws javax.mail.MessagingException,
                   javax.mail.internet.AddressException,
                   BuildException
here is where the mail is sent
Throws:
MessagingException - Description of Exception
AddressException - Description of Exception
BuildException - Description of Exception


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.