Oracle

com.compoze.util
Class PreparedEmail

java.lang.Object
  extended by com.compoze.util.PreparedEmail
All Implemented Interfaces:
java.io.Serializable

public class PreparedEmail
extends java.lang.Object
implements java.io.Serializable

This class wraps the information needed to send an email message, and uses the javax.mail API to send the message.

See Also:
Serialized Form

Constructor Summary
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, byte[] body, java.lang.String sContentType)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.io.File templateFile, java.util.HashMap replacementMap)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.io.File templateFile, java.util.HashMap replacementMap, java.lang.String sContentType)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.io.Reader templateReader, java.util.HashMap replacementMap)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.io.Reader templateReader, java.util.HashMap replacementMap, java.lang.String sContentType, DataSource dataSource, java.lang.String sAttachmentName)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.lang.String sBody)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.lang.String sBody, DataSource dataSource, java.lang.String sAttachmentName)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.lang.String sBody, java.lang.String sContentType)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sCc, java.lang.String sBcc, java.lang.String sSubject, byte[] body, java.io.Reader templateReader, java.util.HashMap replacementMap, java.lang.String sContentType, DataSource dataSource, java.lang.String sAttachmentName)
          Constructor.
PreparedEmail(java.lang.String sMailHost, java.lang.String sFrom, java.lang.String sTo, java.lang.String sSubject, java.lang.String sBody, java.lang.String sContentType, DataSource dataSource, java.lang.String sAttachmentName)
          Constructor.
 
Method Summary
 void send()
          Send the email.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.lang.String sBody)
Constructor. The content-type defaults to text/plain.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
sBody - the body

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.lang.String sBody,
                     java.lang.String sContentType)
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
sBody - the body

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     byte[] body,
                     java.lang.String sContentType)
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
body - the body
sContentType - the content type

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.io.File templateFile,
                     java.util.HashMap replacementMap)
              throws java.io.FileNotFoundException,
                     java.io.IOException
Constructor. The content-type defaults to text/plain.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
templateFile - the template file
replacementMap - the replacement map
Throws:
java.io.FileNotFoundException - if the file could not be found
java.io.IOException - if an i/o error occurred

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.io.File templateFile,
                     java.util.HashMap replacementMap,
                     java.lang.String sContentType)
              throws java.io.FileNotFoundException,
                     java.io.IOException
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
templateFile - the template file
replacementMap - the replacement map
Throws:
java.io.FileNotFoundException - if the file could not be found
java.io.IOException - if an i/o error occurred

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.io.Reader templateReader,
                     java.util.HashMap replacementMap)
              throws java.io.IOException
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
templateReader - the template reader
replacementMap - the replacement map
sContentType - the content-type
Throws:
java.io.IOException - if an i/o error occurred

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.io.Reader templateReader,
                     java.util.HashMap replacementMap,
                     java.lang.String sContentType,
                     DataSource dataSource,
                     java.lang.String sAttachmentName)
              throws java.io.IOException
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
templateReader - the template reader
replacementMap - the replacement map
sContentType - the content-type
Throws:
java.io.IOException - if an i/o error occurred

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sCc,
                     java.lang.String sBcc,
                     java.lang.String sSubject,
                     byte[] body,
                     java.io.Reader templateReader,
                     java.util.HashMap replacementMap,
                     java.lang.String sContentType,
                     DataSource dataSource,
                     java.lang.String sAttachmentName)
              throws java.io.IOException
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
templateReader - the template reader
replacementMap - the replacement map
sContentType - the content-type
Throws:
java.io.IOException - if an i/o error occurred

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.lang.String sBody,
                     java.lang.String sContentType,
                     DataSource dataSource,
                     java.lang.String sAttachmentName)
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
sBody - the body
sContentType - the content type
dataSource - the attachment data source
sAttachmentName - the attachment name

PreparedEmail

public PreparedEmail(java.lang.String sMailHost,
                     java.lang.String sFrom,
                     java.lang.String sTo,
                     java.lang.String sSubject,
                     java.lang.String sBody,
                     DataSource dataSource,
                     java.lang.String sAttachmentName)
Constructor.

Parameters:
sMailHost - the mail server host
sFrom - the from address
sTo - the to address
sSubject - the subject
sBody - the body
dataSource - the attachment data source
sAttachmentName - the attachment name
Method Detail

send

public void send()
          throws MessagingException,
                 AddressException,
                 java.io.IOException
Send the email.

Throws:
MessagingException - if an exception occurred in sending the email
AddressException - if a specified email address is invalid
java.io.IOException - if an i/o error occurred

Oracle

Copyright ©1999-2008 Oracle All rights reserved.