org.sape.carbon.services.email
Class MailDataObject

java.lang.Object
  |
  +--org.sape.carbon.services.email.MailDataObject

public class MailDataObject
extends Object

This class encapsulates all the information required to send an email.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.1
Author:
$Author: dvoet $ $Date: 2003/05/05 21:21:29 $

Field Summary
private  MailAttachment[] attachments
          A array containing the attachments to be send alongwith the mail.
private  HashMap bccMap
          A Map containing the mapping of email to names for all 'BCC' recipients of the mail.
private  String body
          The body of the mail.
private  MailContentTypeEnum bodyType
          The bodyType of the mail.
private  HashMap ccMap
          A Map containing the mapping of email to names for all 'CC' recipients of the mail.
private  String charset
          The charset used to encode the contents of the mail.
private  String fromEmail
          The email address for the sender of the mail.
private  String fromPersonal
          The name of the sender of the mail.
private  HashMap headers
          A Map containing the mapping of header name to header value for any additional headers for the mail.
private  String subject
          The subject of the mail.
private  HashMap toMap
          A Map containing the mapping of emails to names for all 'TO' recipients of the mail.
 
Constructor Summary
MailDataObject()
          Initializes all the HashMap's
 
Method Summary
 void addBCC(Map bccMap)
          Adds a map of recipients email id to name in 'BCC' recipients of the mail.
 void addBCC(String bccEmail, String bccPersonal)
          Adds a recipient email id and name in 'BCC' recipients of the mail.
 void addCC(Map ccMap)
          Adds a map of recipients email id to name in 'CC' recipients of the mail.
 void addCC(String ccEmail, String ccPersonal)
          Adds a recipient email id and name in 'CC' recipients of the mail.
 void addHeader(Map headers)
          Adds any addtional headers.
 void addHeader(String headerName, String headerValue)
          Adds any addtional headers.
 void addTo(Map toMap)
          Adds a map of recipients email id to name in 'TO' recipients of the mail.
 void addTo(String toEmail, String toPersonal)
          Adds a recipient email id and name in 'TO' recipients of the mail.
 MailAttachment[] getAttachments()
          Getter for attachments.
 Map getBCCMap()
          Getter for 'BCC' recipients in the mail.
 String getBody()
          Getter for body.
 MailContentTypeEnum getBodyType()
          Getter for body type.
 Map getCCMap()
          Getter for 'CC' recipients in the mail.
 String getCharset()
          Getter for charset.
 String getFromEmail()
          Getter for sender's email id.
 String getFromName()
          Getter for sender's name.
 Map getHeaders()
          Getter for additional headers in the mail.
 String getSubject()
          Getter for subject.
 Map getToMap()
          Getter for 'TO' recipients in the mail.
 void setAttachments(MailAttachment[] attachments)
          Sets the Attachments to be send alongwith the mail.
 void setBody(String body, MailContentTypeEnum bodyType)
          Set's the mail body and body type.
 void setCharset(String charset)
          Setter for charset.
 void setFrom(String fromEmail, String fromPersonal)
          Set's the sender's email id and name.
 void setSubject(String subject)
          Setter for mail subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toMap

private HashMap toMap

A Map containing the mapping of emails to names for all 'TO' recipients of the mail.


ccMap

private HashMap ccMap

A Map containing the mapping of email to names for all 'CC' recipients of the mail.


bccMap

private HashMap bccMap

A Map containing the mapping of email to names for all 'BCC' recipients of the mail.


headers

private HashMap headers

A Map containing the mapping of header name to header value for any additional headers for the mail.


fromEmail

private String fromEmail

The email address for the sender of the mail.


fromPersonal

private String fromPersonal

The name of the sender of the mail.


subject

private String subject

The subject of the mail.


body

private String body

The body of the mail.


charset

private String charset

The charset used to encode the contents of the mail.


bodyType

private MailContentTypeEnum bodyType

The bodyType of the mail.


attachments

private MailAttachment[] attachments

A array containing the attachments to be send alongwith the mail.

Constructor Detail

MailDataObject

public MailDataObject()

Initializes all the HashMap's

Method Detail

addTo

public void addTo(String toEmail,
                  String toPersonal)

Adds a recipient email id and name in 'TO' recipients of the mail.

Parameters:
toEmail - The email id of the recipient.
toPersonal - The name of the recipient.

addTo

public void addTo(Map toMap)

Adds a map of recipients email id to name in 'TO' recipients of the mail.

Parameters:
toMap - A Map containing the mapping of emails to names for all 'TO' recipients of the email.

addCC

public void addCC(String ccEmail,
                  String ccPersonal)

Adds a recipient email id and name in 'CC' recipients of the mail.

Parameters:
ccEmail - The email id of the recipient.
ccPersonal - The name of the recipient.

addCC

public void addCC(Map ccMap)

Adds a map of recipients email id to name in 'CC' recipients of the mail.

Parameters:
ccMap - A Map containing the mapping of emails to names for all 'CC' recipients of the email.

addBCC

public void addBCC(String bccEmail,
                   String bccPersonal)

Adds a recipient email id and name in 'BCC' recipients of the mail.

Parameters:
bccEmail - The email id of the recipient.
bccPersonal - The name of the recipient.

addBCC

public void addBCC(Map bccMap)

Adds a map of recipients email id to name in 'BCC' recipients of the mail.

Parameters:
bccMap - A Map containing the mapping of emails to names for all 'BCC' recipients of the email.

setFrom

public void setFrom(String fromEmail,
                    String fromPersonal)

Set's the sender's email id and name.

Parameters:
fromEmail - The sender's email id.
fromPersonal - The sender's name.

setSubject

public void setSubject(String subject)

Setter for mail subject.

Parameters:
subject - the subject of the message

setBody

public void setBody(String body,
                    MailContentTypeEnum bodyType)

Set's the mail body and body type.

Parameters:
body - content of the message
bodyType - type of message body (plain, html, etc)

setCharset

public void setCharset(String charset)

Setter for charset.

Parameters:
charset - the charset of the mail message

addHeader

public void addHeader(String headerName,
                      String headerValue)

Adds any addtional headers.

Parameters:
headerName - name of header to add
headerValue - value of the header

addHeader

public void addHeader(Map headers)

Adds any addtional headers.

Parameters:
headers - additional headers to add to the message

setAttachments

public void setAttachments(MailAttachment[] attachments)

Sets the Attachments to be send alongwith the mail.

Parameters:
attachments - A array containing the attachments to be send along with the mail.

getToMap

public Map getToMap()

Getter for 'TO' recipients in the mail.

Returns:
toMap.

getCCMap

public Map getCCMap()

Getter for 'CC' recipients in the mail.

Returns:
ccMap.

getBCCMap

public Map getBCCMap()

Getter for 'BCC' recipients in the mail.

Returns:
bccMap.

getHeaders

public Map getHeaders()

Getter for additional headers in the mail.

Returns:
headers.

getFromName

public String getFromName()

Getter for sender's name.

Returns:
fromPersonal.

getFromEmail

public String getFromEmail()

Getter for sender's email id.

Returns:
fromEmail.

getCharset

public String getCharset()

Getter for charset.

Returns:
charset.

getSubject

public String getSubject()

Getter for subject.

Returns:
subject.

getBody

public String getBody()

Getter for body.

Returns:
body.

getBodyType

public MailContentTypeEnum getBodyType()

Getter for body type.

Returns:
bodyType.

getAttachments

public MailAttachment[] getAttachments()

Getter for attachments.

Returns:
attachments


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.