net.christopherschultz.mail
Class MailMessage

java.lang.Object
  extended by net.christopherschultz.mail.MailMessage

public class MailMessage
extends Object

Provides a nice wrapper around the javamail API for building an email message to send. Supports plain text setPlainText(java.lang.String) and HTML bodies setHTMLText(java.lang.String), attachments attach(java.io.File), and embedded files for use within the HTML body embedHTML(javax.activation.DataSource). Uses UTF-8 as the character set to encode addresses. Indirectly uses (javamail does this) the content-type specified by " ;charset=" in calls to setPlainText(String,String)

Version:
1.0a 2009-09-17
Author:
Chris Schultz

Field Summary
static String DISPOSITION_ATTACHMENT
          A content disposition indicating that an attachment is to be attached as a separate file.
static String DISPOSITION_INLINE
          A content disposition indicating that an attachment is to be placed inline.
 
Constructor Summary
MailMessage()
          Creates a new MailMessage.
 
Method Summary
 MailMessage addBcc(javax.mail.Address address)
          Adds a blind carbon-copy (BCC) recipient to this message.
 MailMessage addBcc(String email)
          Adds a blind carbon-copy (BCC) recipient to this message.
 MailMessage addBcc(String email, String name)
          Adds a blind carbon-copy (BCC) recipient to this message.
 MailMessage addCc(javax.mail.Address address)
          Adds a carbon-copy (CC) recipient to this message.
 MailMessage addCc(String email)
          Adds a carbon-copy (CC) recipient to this message.
 MailMessage addCc(String email, String name)
          Adds a carbon-copy (CC) recipient to this message.
 MailMessage addHeader(String name, String value)
          Adds an SMTP header to this MailMessage.
 MailMessage addReplyTo(javax.mail.Address address)
          Adds a reply-to recipient to this message.
 MailMessage addReplyTo(String email)
          Adds a reply-to recipient to this message.
 MailMessage addReplyTo(String email, String name)
          Adds a reply-to recipient to this message.
 MailMessage addTo(javax.mail.Address address)
          Adds a recipient to this message.
 MailMessage addTo(String email)
          Adds a recipient to this message.
 MailMessage addTo(String email, String name)
          Adds a recipient to this message.
 MailMessage attach(javax.activation.DataSource dataSource, String name)
          Attaches the specified DataSource to this message.
 MailMessage attach(javax.activation.DataSource dataSource, String name, String description)
          Attaches the specified DataSource to this message.
 MailMessage attach(javax.activation.DataSource dataSource, String name, String description, String disposition)
          Attaches the specified DataSource to this message.
 MailMessage attach(File file)
          Attaches the specified file to this message.
 MailMessage attach(String name, File file)
          Attaches the specified file to this message.
 MailMessage attach(String name, String description, File file)
          Attaches the specified file to this message.
 MailMessage attach(String name, String description, String contentType, String disposition, File file)
          Attaches the specified file to this message.
 javax.mail.internet.MimeMessage buildMimeMessage(javax.mail.Session session)
          Builds a MimeMessage object from this MailMessage.
protected  javax.mail.internet.MimeBodyPart createHTMLBodyPart(boolean includeMultipartPreamble)
           
 String embedHTML(javax.activation.DataSource dataSource)
          Embeds the specified DataSource in this message's HTML part.
 String embedHTML(javax.activation.DataSource dataSource, String name)
          Embeds the specified DataSource in this message's HTML part.
 String embedHTML(javax.activation.DataSource dataSource, String name, String description)
          Embeds the specified DataSource in this message's HTML part.
 String embedHTML(javax.activation.DataSource dataSource, String name, String description, String contentId)
          Embeds the specified DataSource in this message's HTML part.
 String embedHTML(File file)
          Embeds the specified File in this message's HTML part.
 String embedHTML(String name, File file)
          Embeds the specified File in this message's HTML part.
 String embedHTML(String name, String description, File file)
          Embeds the specified File in this message's HTML part.
 String embedHTML(String name, String description, String contentType, File file)
          Embeds the specified File in this message's HTML part.
 String embedHTML(String name, String description, String contentType, String contentId, File file)
          Embeds the specified File in this message's HTML part.
protected  String generateContentId()
           
protected  javax.mail.internet.InternetAddress makeInternetAddress(String email, String name, String charset)
           
 void send(javax.mail.Session session, javax.mail.Transport transport)
          Sends this message using the specified Session and Transport.
 MailMessage setBcc(javax.mail.Address address)
          Sets the blind carbon-copy (BCC) recipient for this message.
 MailMessage setBcc(String email)
          Sets the blind carbon-copy (BCC) recipient for this message.
 MailMessage setBcc(String email, String name)
          Sets the blind carbon-copy (BCC) recipient for this message.
protected  void setBody(Object messageContainer, boolean includeMultipartPreamble)
           
 MailMessage setCc(javax.mail.Address address)
          Sets the carbon-copy (CC) recipient of this message.
 MailMessage setCc(String email)
          Sets the carbon-copy (CC) recipient of this message.
 MailMessage setCc(String email, String name)
          Sets the carbon-copy (CC) recipient of this message.
 MailMessage setFrom(javax.mail.Address address)
          Sets the sender of this message.
 MailMessage setFrom(String email)
          Sets the sender of this message.
 MailMessage setFrom(String email, String name)
          Sets the sender of this message.
 MailMessage setHTMLText(String htmlText)
          Sets the HTML body of this message.
 MailMessage setHTMLText(String htmlText, String contentType)
          Sets the HTML body of this message.
 MailMessage setMultipartPreamble(String multipartPreamble)
          Sets the multipart preamble for this message.
 MailMessage setPlainText(String plainText)
          Sets the plain-text body of this message.
 MailMessage setPlainText(String plainText, String contentType)
          Sets the plain-text body of this message.
 MailMessage setReplyTo(javax.mail.Address address)
          Sets the reply-to address for this message.
 MailMessage setReplyTo(String email)
          Sets the reply-to address for this message.
 MailMessage setReplyTo(String email, String name)
          Sets the reply-to address for this message.
 MailMessage setSender(javax.mail.Address address)
          Sets the sender of this message.
 MailMessage setSender(String email)
          Sets the sender of this message.
 MailMessage setSender(String email, String name)
          Sets the sender of this message.
protected  void setSimpleBody(Object messageContainer, String text, String contentType)
           
 MailMessage setSubject(String subject)
          Sets the subject of this message.
 MailMessage setTo(javax.mail.Address address)
          Sets the recipient of this message.
 MailMessage setTo(String email)
          Sets the recipient of this message.
 MailMessage setTo(String email, String name)
          Sets the recipient of this message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPOSITION_ATTACHMENT

public static final String DISPOSITION_ATTACHMENT
A content disposition indicating that an attachment is to be attached as a separate file.

See Also:
Constant Field Values

DISPOSITION_INLINE

public static final String DISPOSITION_INLINE
A content disposition indicating that an attachment is to be placed inline.

See Also:
Constant Field Values
Constructor Detail

MailMessage

public MailMessage()
Creates a new MailMessage.

Method Detail

setMultipartPreamble

public MailMessage setMultipartPreamble(String multipartPreamble)
Sets the multipart preamble for this message. The multipart preamble is the text included as the body for the top-level multipart portion of the message. If set, and a multipart message will be generated, then this text will be used as the multipart body. The default preamble is "This is a multi-part message in MIME format.".

Parameters:
multipartPreamble - The preamble to use for multipart messages.
Returns:
This MailMessage

setSender

public MailMessage setSender(String email)
                      throws UnsupportedEncodingException,
                             javax.mail.internet.AddressException
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
email - The email address of the sender.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setFrom(String)

setSender

public MailMessage setSender(String email,
                             String name)
                      throws UnsupportedEncodingException,
                             javax.mail.internet.AddressException
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
email - The email address of the sender.
name - The name of the sender.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setFrom(String,String)

setSender

public MailMessage setSender(javax.mail.Address address)
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
address - The address of the sender.
Returns:
This MailMessage
See Also:
setFrom(Address)

setFrom

public MailMessage setFrom(String email)
                    throws UnsupportedEncodingException,
                           javax.mail.internet.AddressException
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
email - The email address of the sender.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setSender(String)

setFrom

public MailMessage setFrom(String email,
                           String name)
                    throws UnsupportedEncodingException,
                           javax.mail.internet.AddressException
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
email - The email address of the sender.
name - The name of the sender.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setSender(String,String)

setFrom

public MailMessage setFrom(javax.mail.Address address)
Sets the sender of this message. Sender is distinct from from in that the sender is typically the actual sender acting on behalf of the from address.

Parameters:
address - The address of the sender.
Returns:
This MailMessage
See Also:
setSender(Address)

setReplyTo

public MailMessage setReplyTo(String email)
                       throws UnsupportedEncodingException,
                              javax.mail.internet.AddressException
Sets the reply-to address for this message.

Parameters:
email - The reply-to email address for this message.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addReplyTo(String)

setReplyTo

public MailMessage setReplyTo(String email,
                              String name)
                       throws UnsupportedEncodingException,
                              javax.mail.internet.AddressException
Sets the reply-to address for this message.

Parameters:
email - The reply-to email address for this message.
name - The name of the reply-to recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addReplyTo(String,String)

setReplyTo

public MailMessage setReplyTo(javax.mail.Address address)
Sets the reply-to address for this message.

Parameters:
address - The reply-to address for this message.
Returns:
This MailMessage
See Also:
addReplyTo(Address)

addReplyTo

public MailMessage addReplyTo(String email)
                       throws UnsupportedEncodingException,
                              javax.mail.internet.AddressException
Adds a reply-to recipient to this message.

Parameters:
email - The email address of the reply-to recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setReplyTo(String)

addReplyTo

public MailMessage addReplyTo(String email,
                              String name)
                       throws UnsupportedEncodingException,
                              javax.mail.internet.AddressException
Adds a reply-to recipient to this message.

Parameters:
email - The email address of the reply-to recipient.
name - The name of the reply-to recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setReplyTo(String,String)

addReplyTo

public MailMessage addReplyTo(javax.mail.Address address)
Adds a reply-to recipient to this message.

Parameters:
address - The address of the reply-to recipient.
Returns:
This MailMessage
See Also:
setReplyTo(Address)

setTo

public MailMessage setTo(String email)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Sets the recipient of this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addTo(String)

setTo

public MailMessage setTo(String email,
                         String name)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Sets the recipient of this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addTo(String,String)

setTo

public MailMessage setTo(javax.mail.Address address)
Sets the recipient of this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
See Also:
addTo(Address)

addTo

public MailMessage addTo(String email)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Adds a recipient to this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setTo(String)

addTo

public MailMessage addTo(String email,
                         String name)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Adds a recipient to this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setTo(String,String)

addTo

public MailMessage addTo(javax.mail.Address address)
Adds a recipient to this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
See Also:
setTo(Address)

setCc

public MailMessage setCc(String email)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Sets the carbon-copy (CC) recipient of this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addCc(String,String)

setCc

public MailMessage setCc(String email,
                         String name)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Sets the carbon-copy (CC) recipient of this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addCc(String,String)

setCc

public MailMessage setCc(javax.mail.Address address)
Sets the carbon-copy (CC) recipient of this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
See Also:
addCc(Address)

addCc

public MailMessage addCc(String email)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Adds a carbon-copy (CC) recipient to this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setCc(String)

addCc

public MailMessage addCc(String email,
                         String name)
                  throws UnsupportedEncodingException,
                         javax.mail.internet.AddressException
Adds a carbon-copy (CC) recipient to this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setCc(String,String)

addCc

public MailMessage addCc(javax.mail.Address address)
Adds a carbon-copy (CC) recipient to this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
See Also:
setCc(Address)

setBcc

public MailMessage setBcc(String email)
                   throws UnsupportedEncodingException,
                          javax.mail.internet.AddressException
Sets the blind carbon-copy (BCC) recipient for this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addBcc(String,String)

setBcc

public MailMessage setBcc(String email,
                          String name)
                   throws UnsupportedEncodingException,
                          javax.mail.internet.AddressException
Sets the blind carbon-copy (BCC) recipient for this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
addBcc(String,String)

setBcc

public MailMessage setBcc(javax.mail.Address address)
Sets the blind carbon-copy (BCC) recipient for this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
See Also:
addBcc(Address)

addBcc

public MailMessage addBcc(String email)
                   throws UnsupportedEncodingException,
                          javax.mail.internet.AddressException
Adds a blind carbon-copy (BCC) recipient to this message.

Parameters:
email - The email address of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setBcc(String)

addBcc

public MailMessage addBcc(String email,
                          String name)
                   throws UnsupportedEncodingException,
                          javax.mail.internet.AddressException
Adds a blind carbon-copy (BCC) recipient to this message.

Parameters:
email - The email address of the recipient.
name - The name of the recipient.
Returns:
This MailMessage
Throws:
javax.mail.internet.AddressException - If there is a problem with the email address.
UnsupportedEncodingException
See Also:
setBcc(String,String)

addBcc

public MailMessage addBcc(javax.mail.Address address)
Adds a blind carbon-copy (BCC) recipient to this message.

Parameters:
address - The address of the recipient.
Returns:
This MailMessage
See Also:
setBcc(Address)

setSubject

public MailMessage setSubject(String subject)
Sets the subject of this message.

Parameters:
subject - The subject of this message.
Returns:
This MailMessage

setPlainText

public MailMessage setPlainText(String plainText)
Sets the plain-text body of this message.

Parameters:
plainText - The text to use as the body of this message.
Returns:
This MailMessage

setPlainText

public MailMessage setPlainText(String plainText,
                                String contentType)
Sets the plain-text body of this message.

Parameters:
plainText - The text to use as the body of this message.
contentType - The MIME type to use for the message body.
Returns:
This MailMessage

setHTMLText

public MailMessage setHTMLText(String htmlText)
Sets the HTML body of this message.

Parameters:
htmlText - The HTML text to use as the body of this message.
Returns:
This MailMessage

setHTMLText

public MailMessage setHTMLText(String htmlText,
                               String contentType)
Sets the HTML body of this message.

Parameters:
htmlText - The HTML text to use as the body of this message.
contentType - The MIME type to use for the message body.
Returns:
This MailMessage

attach

public MailMessage attach(File file)
Attaches the specified file to this message.

Parameters:
file - The file to attach.
Returns:
This MailMessage

attach

public MailMessage attach(String name,
                          File file)
Attaches the specified file to this message.

Parameters:
name - The name of the attachment.
file - The file to attach.
Returns:
This MailMessage

attach

public MailMessage attach(String name,
                          String description,
                          File file)
Attaches the specified file to this message.

Parameters:
name - The name of the attachment.
description - The description of the attachment.
file - The file to attach.
Returns:
This MailMessage

attach

public MailMessage attach(String name,
                          String description,
                          String contentType,
                          String disposition,
                          File file)
Attaches the specified file to this message.

Parameters:
name - The name of the attachment.
description - The description of the attachment.
contentType - The MIME type of the attachment.
disposition - Either DISPOSITION_INLINE or DISPOSITION_ATTACHMENT
file - The file to attach.
Returns:
This MailMessage

attach

public MailMessage attach(javax.activation.DataSource dataSource,
                          String name)
Attaches the specified DataSource to this message.

Parameters:
dataSource - The dataSource representing the data to attach.
name - The name of the attachment.
Returns:
This MailMessage

attach

public MailMessage attach(javax.activation.DataSource dataSource,
                          String name,
                          String description)
Attaches the specified DataSource to this message.

Parameters:
dataSource - The dataSource representing the data to attach.
name - The name of the attachment.
description - The description of the attachment.
Returns:
This MailMessage

attach

public MailMessage attach(javax.activation.DataSource dataSource,
                          String name,
                          String description,
                          String disposition)
Attaches the specified DataSource to this message.

Parameters:
dataSource - The dataSource representing the data to attach.
name - The name of the attachment.
description - The description of the attachment.
disposition - Either DISPOSITION_INLINE or DISPOSITION_ATTACHMENT
Returns:
This MailMessage

embedHTML

public String embedHTML(javax.activation.DataSource dataSource)
Embeds the specified DataSource in this message's HTML part.

Parameters:
dataSource - The dataSource representing the data to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(javax.activation.DataSource dataSource,
                        String name)
Embeds the specified DataSource in this message's HTML part.

Parameters:
dataSource - The dataSource representing the data to embed.
name - The name of the embedded data.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(javax.activation.DataSource dataSource,
                        String name,
                        String description)
Embeds the specified DataSource in this message's HTML part.

Parameters:
dataSource - The dataSource representing the data to embed.
name - The name of the embedded data.
description - The description of the data.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(javax.activation.DataSource dataSource,
                        String name,
                        String description,
                        String contentId)
Embeds the specified DataSource in this message's HTML part.

Parameters:
dataSource - The dataSource representing the data to embed.
name - The name of the embedded data.
contentId - The content id to use for the embedded data.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(File file)
Embeds the specified File in this message's HTML part.

Parameters:
file - The file to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(String name,
                        File file)
Embeds the specified File in this message's HTML part.

Parameters:
name - The name of the embedded data.
file - The file to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(String name,
                        String description,
                        File file)
Embeds the specified File in this message's HTML part.

Parameters:
name - The name of the embedded data.
description - The description of the embedded file.
file - The file to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(String name,
                        String description,
                        String contentType,
                        File file)
Embeds the specified File in this message's HTML part.

Parameters:
name - The name of the embedded data.
description - The description of the embedded file.
contentType - The MIME type of the embedded file.
file - The file to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

embedHTML

public String embedHTML(String name,
                        String description,
                        String contentType,
                        String contentId,
                        File file)
Embeds the specified File in this message's HTML part.

Parameters:
name - The name of the embedded data.
description - The description of the embedded file.
contentType - The MIME type of the embedded file.
contentId - The content id to use for the embedded data.
file - The file to embed.
Returns:
The content id, suitable for use within the HTML body for reference.

addHeader

public MailMessage addHeader(String name,
                             String value)
Adds an SMTP header to this MailMessage.

Parameters:
name - The name of the header.
value - The value of the header.
Returns:
This MailMessage

send

public void send(javax.mail.Session session,
                 javax.mail.Transport transport)
          throws javax.mail.MessagingException
Sends this message using the specified Session and Transport.

Parameters:
session - The JavaMail session to use.
transport - The JavaMail transport to use.
Throws:
javax.mail.MessagingException - If there is a problem building or sending this message.

buildMimeMessage

public javax.mail.internet.MimeMessage buildMimeMessage(javax.mail.Session session)
                                                 throws javax.mail.MessagingException
Builds a MimeMessage object from this MailMessage.

Parameters:
session - The JavaMail session in use. null seems to work okay, too.
Returns:
A MimeMessage including everything from this MailMessage.
Throws:
javax.mail.MessagingException - If there is a problem converting this MailMessage into a MimeMessage.

makeInternetAddress

protected javax.mail.internet.InternetAddress makeInternetAddress(String email,
                                                                  String name,
                                                                  String charset)
                                                           throws UnsupportedEncodingException,
                                                                  javax.mail.internet.AddressException
Throws:
UnsupportedEncodingException
javax.mail.internet.AddressException

generateContentId

protected String generateContentId()

setBody

protected void setBody(Object messageContainer,
                       boolean includeMultipartPreamble)
                throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

createHTMLBodyPart

protected javax.mail.internet.MimeBodyPart createHTMLBodyPart(boolean includeMultipartPreamble)
                                                       throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

setSimpleBody

protected void setSimpleBody(Object messageContainer,
                             String text,
                             String contentType)
                      throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException