Java Tool Kit

ITT.WAFr.Utilities
Class Email

java.lang.Object
  extended byITT.WAFr.Utilities.Email

public final class Email
extends Object

The Email class represents an SMTP email message.

This lightweight class provides simple and convenient methods to add or set:

The Email class can send anonymous messages or negotiate authentication for secure SMTP host servers.

This class utilizes and wraps standard JavaMail 1.3.1 and Java Activation Framework 1.0.2 objects and therefore requires the class library for each. WAFr and the Java Tool Kit comes fully packaged with the required .jar files.


Nested Class Summary
 class Email.AddressException
          This exception is thrown when a specified entry could not be converted to a valid email address.
 class Email.AttachmentException
          This exception is thrown when an attachment fails to be added to the message envelop.
 class Email.DeliveryException
          This exception is thrown when an email message cannot be delivered due to a server or transport configuration error.
 class Email.FileNotFoundException
          This exception is thrown when the specified file to be added as a message attachment could not be found.
 class Email.NoDataException
          This exception is thrown when the specified input stream representing an attachment to be added the email message, contains no data.
 class Email.PropertyException
          This exception is thrown when an Email object property fails to set due to an invalid value.
 class Email.StreamException
          This exception is thrown when the specified input stream could not be parsed into a valid message attachment.
 
Constructor Summary
Email()
          Constructs a new Email object requiring an SMTP host server and credentials to be specified upon sending.
Email(Properties oProperties)
          Constructs a new Email object that utilizes the specified Properties object, oProperties, containing a list of settings such as mail.smtp.host.
Email(String sHostServer)
          Constructs a new Email object, to be sent anonymously, that utilizes the specified String parameter, sHostServer, as the host server.
Email(String sHostServer, boolean bAuthenticate)
          Constructs a new Email object that utilizes the specified String parameter, sHostServer, as the host server and whether or not authentication should be attempted when sending the message, determined by the boolean, bAuthenticate, parameter.
 
Method Summary
 void AddAttachment(byte[] iContent, String sFileName, String sContentType)
          A convenience method or alias to Attachment(byte[],String,String).
 void AddAttachment(byte[] iContent, String sFileName, String sContentType, String sContentId)
          A convenience method or alias to Attachment(byte[],String,String,String).
 void AddAttachment(File oFile)
          A convenience method or alias to Attachment(File).
 void AddAttachment(File oFile, String sContentId)
          A convenience method or alias to Attachment(File,String).
 void AddAttachment(String sFilePath)
          A convenience method or alias to Attachment(String).
 void AddAttachment(String sFilePath, String sContentId)
          A convenience method or alias to Attachment(String,String).
 void AddAttachment(Upload.PostedFile oContent)
          A convenience method or alias to Attachment(Upload.PostedFile).
 void AddAttachment(Upload.PostedFile oContent, String sContentId)
          A convenience method or alias to Attachment(Upload.PostedFile,String).
 void AddBcc(String sAddress)
          Preserves the "BCC" (blind carbon copy) property of the message and appends the specified String representing a valid email address.
 void AddBcc(String[] sAddresses)
          Preserves the "BCC" (blind carbon copy) property of the message and appends the specified String array representing a list of a valid email addresses.
 void AddCc(String sAddress)
          Preserves the "CC" (carbon copy) property of the message and appends the specified String representing a valid email address.
 void AddCc(String[] sAddresses)
          Preserves the "CC" (carbon copy) property of the message and appends the specified String array representing a list of a valid email addresses.
 void AddFrom(String sAddress)
          Preserves the "FROM" property of the message and appends the specified String representing a valid email address.
 void AddFrom(String[] sAddresses)
          Preserves the "FROM" property of the message and appends the specified String array representing a list of a valid email addresses.
 void AddHeader(String sName, String sValue)
          Preserves the current values of the specified header field of the message and appends the specified String value.
 void AddTo(String sAddress)
          Preserves the "TO" property of the message and appends the specified String representing a valid email address.
 void AddTo(String[] sAddresses)
          Preserves the "TO" property of the message and appends the specified String array representing a list of a valid email addresses.
 void Attachment(byte[] iContent, String sFileName, String sContentType)
          Preserves any existing message attachments and adds the byte array specified in the input parameter, iContent, containing the content of a file, to the attachment envelop.
 void Attachment(byte[] iContent, String sFileName, String sContentType, String sContentId)
          Preserves any existing message attachments and adds the byte array specified in the input parameter, iContent, containing the content of a file, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.
 void Attachment(File oFile)
          Preserves any existing message attachments and adds the File object, oFile, to the attachment envelop.
 void Attachment(File oFile, String sContentId)
          Preserves any existing message attachments and adds the File object, oFile, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.
 void Attachment(String sFilePath)
          Preserves any existing message attachments and adds the file with the path of sFilePath to the attachment envelop.
 void Attachment(String sFilePath, String sContentId)
          Preserves any existing message attachments and adds the file with the path specified in the String parameter, sFilePath, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.
 void Attachment(Upload.PostedFile oContent)
          Preserves any existing message attachments and adds the data represented by the Upload.PostedFile, oContent, to the attachment envelop.
 void Attachment(Upload.PostedFile oContent, String sContentId)
          Preserves any existing message attachments and adds the data represented by the Upload.PostedFile, oContent, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.
 void Bcc(String sAddress)
          Clears the "BCC" (blind carbon copy) property of the message and sets it to the specified String representing a valid email address.
 void Bcc(String[] sAddresses)
          Clears the "BCC" (blind carbon copy) property of the message and sets it to the specified String array representing a list of a valid email addresses.
 void Body(String sBody)
          Set the "BODY" property of the message and to the specified String.
 void Cc(String sAddress)
          Clears the "CC" (carbon copy) property of the message and sets it to the specified String representing a valid email address.
 void Cc(String[] sAddresses)
          Clears the "CC" (carbon copy) property of the message and sets it to the specified String array representing a list of a valid email addresses.
 void DeleteHeader(String sName)
          Deletes the specified header from the message.
 void DeleteHeaders(String[] sNames)
          Deletes the specified headers from the message.
 void From(String sAddress)
          Clears the "FROM" property of the message and sets it to the specified String representing a valid email address.
 void Header(String sName, String sValue)
          Clears the current value of the specified header field of the message and sets it to the specified String value.
 void ReplyTo(String sAddress)
          Clears the "REPLY TO" property of the message and sets it to the specified String representing a valid email address.
 void ReplyTo(String[] sAddresses)
          Clears the "REPLY TO" property of the message and sets it to the specified String array representing a list of a valid email addresses.
 void Send()
          Sends the message contained within the Email object.
 void Send(String sUsername, String sPassword)
          Sends the message contained withing the Email object.
 void Send(String sHost, String sUsername, String sPassword)
          Sends the message contained withing the Email object.
 void Sender(String sAddress)
          Clears the "SENDER" header field of the message and sets it to the specified String representing a valid email address.
 void SentDate(Date dDate)
          Clears the "DATE" header field of the message and sets it to the specified Date representing the date and time the message was sent.
 void Subject(String sSubject)
          Sets the "SUBJECT" property of the message to the specified text String.
 void To(String sAddress)
          Clears the "TO" property of the message and sets it to the specified String representing a valid email address.
 void To(String[] sAddresses)
          Clears the "TO" property of the message and sets it to the specified String array representing a list of a valid email addresses.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Email

public Email()
Constructs a new Email object requiring an SMTP host server and credentials to be specified upon sending.

See Also:
Send(String,String,String)

Email

public Email(Properties oProperties)
Constructs a new Email object that utilizes the specified Properties object, oProperties, containing a list of settings such as mail.smtp.host.

Parameters:
oProperties - a Properties object containing SMTP protocol provider settings specified in com.sun.mail.smtp package description of the JavaMail API.
See Also:
Send()

Email

public Email(String sHostServer)
Constructs a new Email object, to be sent anonymously, that utilizes the specified String parameter, sHostServer, as the host server.

Parameters:
sHostServer - the name or IP address of the SMTP host server to use when sending message anonymously.
See Also:
Send()

Email

public Email(String sHostServer,
             boolean bAuthenticate)
Constructs a new Email object that utilizes the specified String parameter, sHostServer, as the host server and whether or not authentication should be attempted when sending the message, determined by the boolean, bAuthenticate, parameter.

Parameters:
sHostServer - the name or IP address of the SMTP host server to use when sending message.
bAuthenticate - true to attempt authentication, false to send anonymously.
See Also:
Send(), Send(String,String)
Method Detail

AddAttachment

public void AddAttachment(byte[] iContent,
                          String sFileName,
                          String sContentType)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(byte[],String,String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(byte[],String,String)

AddAttachment

public void AddAttachment(byte[] iContent,
                          String sFileName,
                          String sContentType,
                          String sContentId)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(byte[],String,String,String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(byte[],String,String,String)

AddAttachment

public void AddAttachment(File oFile)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(File).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(File)

AddAttachment

public void AddAttachment(File oFile,
                          String sContentId)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(File,String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(File,String)

AddAttachment

public void AddAttachment(String sFilePath)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(String)

AddAttachment

public void AddAttachment(String sFilePath,
                          String sContentId)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(String,String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(String,String)

AddAttachment

public void AddAttachment(Upload.PostedFile oContent)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(Upload.PostedFile).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(Upload.PostedFile)

AddAttachment

public void AddAttachment(Upload.PostedFile oContent,
                          String sContentId)
                   throws Email.AttachmentException,
                          Email.FileNotFoundException,
                          Email.NoDataException,
                          Email.StreamException
A convenience method or alias to Attachment(Upload.PostedFile,String).

Throws:
Email.AttachmentException
Email.FileNotFoundException
Email.NoDataException
Email.StreamException
See Also:
Attachment(Upload.PostedFile,String)

AddBcc

public void AddBcc(String sAddress)
            throws Email.PropertyException,
                   Email.AddressException
Preserves the "BCC" (blind carbon copy) property of the message and appends the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
Bcc(String)

AddBcc

public void AddBcc(String[] sAddresses)
            throws Email.PropertyException,
                   Email.AddressException
Preserves the "BCC" (blind carbon copy) property of the message and appends the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
Bcc(String[])

AddCc

public void AddCc(String sAddress)
           throws Email.PropertyException,
                  Email.AddressException
Preserves the "CC" (carbon copy) property of the message and appends the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
Cc(String)

AddCc

public void AddCc(String[] sAddresses)
           throws Email.PropertyException,
                  Email.AddressException
Preserves the "CC" (carbon copy) property of the message and appends the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
Cc(String[])

AddFrom

public void AddFrom(String sAddress)
             throws Email.PropertyException,
                    Email.AddressException
Preserves the "FROM" property of the message and appends the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
From(String)

AddFrom

public void AddFrom(String[] sAddresses)
             throws Email.PropertyException,
                    Email.AddressException
Preserves the "FROM" property of the message and appends the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.

AddHeader

public void AddHeader(String sName,
                      String sValue)
               throws Email.PropertyException
Preserves the current values of the specified header field of the message and appends the specified String value.

Parameters:
sName - a String containing the name of the message header field.
sValue - a String containing the value to append to the message header.
Throws:
Email.PropertyException - if the property fails to properly set.

AddTo

public void AddTo(String sAddress)
           throws Email.PropertyException,
                  Email.AddressException
Preserves the "TO" property of the message and appends the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
To(String)

AddTo

public void AddTo(String[] sAddresses)
           throws Email.PropertyException,
                  Email.AddressException
Preserves the "TO" property of the message and appends the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
To(String[])

Attachment

public void Attachment(byte[] iContent,
                       String sFileName,
                       String sContentType)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the byte array specified in the input parameter, iContent, containing the content of a file, to the attachment envelop.

The file name to be associated with the attachment can be any String indicated within the parameter, sFileName. A String containing the associated MIME content type is required as the parameter, sContentType. If a null or empty-String value is passed for sContentType, a content type of application/octet-stream will be substituted.

This method will not provide the means to reference the attachment within the HTML message body.

Parameters:
iContent - a byte array containing the content of the file to be attached to the message.
sFileName - a String containing the file name for the attachment.
sContentType - a String containing the MIME content type for the attachment.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(byte[],String,String,String)

Attachment

public void Attachment(byte[] iContent,
                       String sFileName,
                       String sContentType,
                       String sContentId)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the byte array specified in the input parameter, iContent, containing the content of a file, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.

The file name to be associated with the attachment can be any String indicated within the parameter, sFileName. A String containing the associated MIME content type is required for the parameter, sContentType. If a null or empty-String value is passed for sContentType, a content type of application/octet-stream will be substituted.

This method is used to add a relative attachment for referencing within the HTML message body.

Parameters:
iContent - a byte array containing the content of the file to be attached to the message.
sFileName - a String containing the file name for the attachment.
sContentType - a String containing the MIME content type for the attachment.
sContentId - a String containing the reference ID for the attachment.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(byte[],String,String)

Attachment

public void Attachment(File oFile)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the File object, oFile, to the attachment envelop.

This method will not provide the means to reference the attachment within the HTML message body.

Parameters:
oFile - a File object to be attached to the message.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(File,String)

Attachment

public void Attachment(File oFile,
                       String sContentId)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the File object, oFile, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.

This method is used to add a relative attachment for referencing within the HTML message body.

Parameters:
oFile - a File object to be attached to the message.
sContentId - a String containing the reference ID for the attachment.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(File)

Attachment

public void Attachment(String sFilePath)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the file with the path of sFilePath to the attachment envelop.

This method will not provide the means to reference the attachment within the HTML message body.

Parameters:
sFilePath - a String containing the file path of the file to be attached to the message.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(String,String)

Attachment

public void Attachment(String sFilePath,
                       String sContentId)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the file with the path specified in the String parameter, sFilePath, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.

This method is used to add a relative attachment for referencing within the HTML message body.

Parameters:
sFilePath - a String containing the file path of the file to be attached to the message.
sContentId - a String containing the reference ID for the attachment.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(String)

Attachment

public void Attachment(Upload.PostedFile oContent)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the data represented by the Upload.PostedFile, oContent, to the attachment envelop.

This method will not provide the means to reference the attachment within the HTML message body.

Parameters:
oContent - an Upload.PostedFile object containing the file data to be attached to the message.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(Upload.PostedFile,String)

Attachment

public void Attachment(Upload.PostedFile oContent,
                       String sContentId)
                throws Email.AttachmentException,
                       Email.FileNotFoundException,
                       Email.NoDataException,
                       Email.StreamException
Preserves any existing message attachments and adds the data represented by the Upload.PostedFile, oContent, to the attachment envelop with a relative reference ID specified within the String parameter, sContentId.

This method is used to add a relative attachment for referencing within the HTML message body.

Parameters:
oContent - an Upload.PostedFile object containing the file data to be attached to the message.
sContentId - a String containing the reference ID for the attachment.
Throws:
Email.AttachmentException - if the attachments fails to bind to the message.
Email.FileNotFoundException - if the file to be attached cannot be located.
Email.NoDataException - if the attachment contains no data.
Email.StreamException - if the attachment data stream cannot be successfully parsed.
See Also:
Attachment(Upload.PostedFile)

Bcc

public void Bcc(String sAddress)
         throws Email.PropertyException,
                Email.AddressException
Clears the "BCC" (blind carbon copy) property of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
AddBcc(String)

Bcc

public void Bcc(String[] sAddresses)
         throws Email.PropertyException,
                Email.AddressException
Clears the "BCC" (blind carbon copy) property of the message and sets it to the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
AddBcc(String[])

Body

public void Body(String sBody)
          throws Email.PropertyException
Set the "BODY" property of the message and to the specified String.

The String may contain HTML or plain text. If the text contains HTML, the message will contain both an HTML and plain text version of the message body to accommodate all email client applications.

Parameters:
sBody - a String containing the body content of the message.
Throws:
Email.PropertyException - if the property fails to properly set.

Cc

public void Cc(String sAddress)
        throws Email.PropertyException,
               Email.AddressException
Clears the "CC" (carbon copy) property of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
AddCc(String)

Cc

public void Cc(String[] sAddresses)
        throws Email.PropertyException,
               Email.AddressException
Clears the "CC" (carbon copy) property of the message and sets it to the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
AddCc(String[])

DeleteHeader

public void DeleteHeader(String sName)
                  throws Email.PropertyException
Deletes the specified header from the message.

Parameters:
sName - a String containing the name of the message header field.
Throws:
Email.PropertyException - if the property fails to properly delete.

DeleteHeaders

public void DeleteHeaders(String[] sNames)
                   throws Email.PropertyException
Deletes the specified headers from the message.

Parameters:
sNames - a String array containing the names of the message header fields.
Throws:
Email.PropertyException - if any property fails to properly delete.

From

public void From(String sAddress)
          throws Email.PropertyException,
                 Email.AddressException
Clears the "FROM" property of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
AddFrom(String)

Header

public void Header(String sName,
                   String sValue)
            throws Email.PropertyException
Clears the current value of the specified header field of the message and sets it to the specified String value.

Parameters:
sName - a String containing the name of the message header field.
sValue - a String containing the value to set the message header.
Throws:
Email.PropertyException - if the property fails to properly set.

ReplyTo

public void ReplyTo(String sAddress)
             throws Email.PropertyException,
                    Email.AddressException
Clears the "REPLY TO" property of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
ReplyTo(String)

ReplyTo

public void ReplyTo(String[] sAddresses)
             throws Email.PropertyException,
                    Email.AddressException
Clears the "REPLY TO" property of the message and sets it to the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
ReplyTo(String[])

Send

public void Send()
          throws Email.DeliveryException
Sends the message contained within the Email object.

This method is used for Email objects constructed with explicitly declared SMTP host servers using Email(String), Email(String,boolean) or Email(Properties).

Throws:
Email.DeliveryException - if the message fails to deliver successfully.
See Also:
Send(String,String), Send(String,String,String)

Send

public void Send(String sUsername,
                 String sPassword)
          throws Email.DeliveryException
Sends the message contained withing the Email object.

This method is used for Email objects constructed with explicitly declared SMTP host servers requiring authentication using Email(String,boolean) passing true, or Email(Properties) with the mail.smtp.auth property set to true.

Throws:
Email.DeliveryException - if the message fails to deliver successfully.
See Also:
Send(String,String), Send(String,String,String)

Send

public void Send(String sHost,
                 String sUsername,
                 String sPassword)
          throws Email.DeliveryException
Sends the message contained withing the Email object.

This method is used for Email objects constructed without explicitly declared SMTP host servers using Email().

Throws:
Email.DeliveryException - if the message fails to deliver successfully.
See Also:
Send(String,String), Send(String,String,String)

Sender

public void Sender(String sAddress)
            throws Email.PropertyException,
                   Email.AddressException
Clears the "SENDER" header field of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.

SentDate

public void SentDate(Date dDate)
              throws Email.PropertyException
Clears the "DATE" header field of the message and sets it to the specified Date representing the date and time the message was sent.

Parameters:
dDate - a Date containing the date and time the message was sent.
Throws:
Email.PropertyException - if the property fails to properly set.

Subject

public void Subject(String sSubject)
             throws Email.PropertyException
Sets the "SUBJECT" property of the message to the specified text String.

Parameters:
sSubject - a String containing the subject content of the message.
Throws:
Email.PropertyException - if the property fails to properly set.

To

public void To(String sAddress)
        throws Email.PropertyException,
               Email.AddressException
Clears the "TO" property of the message and sets it to the specified String representing a valid email address.

Parameters:
sAddress - a single String representing a valid email address.
Throws:
Email.AddressException - if the String email address cannot be successfully parsed.
Email.PropertyException - if the property fails to properly set.
See Also:
AddTo(String)

To

public void To(String[] sAddresses)
        throws Email.PropertyException,
               Email.AddressException
Clears the "TO" property of the message and sets it to the specified String array representing a list of a valid email addresses.

Parameters:
sAddresses - an array of Strings representing valid email addresses.
Throws:
Email.AddressException - if any of the String email addresses cannot be successfully parsed.
Email.PropertyException - if any property fails to properly set.
See Also:
AddTo(String[])

Java Tool Kit

Copyright ©2004, If•Then Technology