org.appfuse.util
Class MailUtil

java.lang.Object
  extended byorg.appfuse.util.MailUtil

public class MailUtil
extends Object

Utility class to send e-mail.

View Source

Version:
$Revision: 1.1 $ $Date: 2004/03/31 13:04:17 $
Author:
Matt Raible

Constructor Summary
MailUtil()
           
 
Method Summary
static Session getSession()
          Retrieves a Mail session from Tomcat's Resource Factory (JNDI)
static void sendHTMLMessage(String from, String[] to, String[] cc, String subject, String content)
          This method is used to send a HTML Message
static void sendHTMLMessage(String from, String to, String cc, String subject, String content)
          This method overrides the sendHTMLMessage to specify only one sender, rather than an array of senders.
static void sendMessage(String from, String[] to, String[] cc, String subject, String content, String mimeType)
          This method is used to send a Message with a pre-defined mime-type.
static void sendMessage(String from, String to, String cc, String subject, String content, String mimeType)
          This method allows you to specify the mimeType as part of the method call.
static void sendMessage(String from, String to, String cc, String subject, String content, String mimeType, File attachment)
          Convenience method for sending messages with attachments.
static void sendMessageWithAttachment(String from, String[] to, String[] cc, String subject, String content, String mimeType, File attachment)
          This method is used to send a Message with an attachment.
static void sendTextMessage(String from, String[] to, String[] cc, String subject, String content)
          This method is used to send a Text Message.
static void sendTextMessage(String from, String to, String cc, String subject, String content)
          This method overrides the sendTextMessage to specify only one sender, rather than an array of senders.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailUtil

public MailUtil()
Method Detail

getSession

public static Session getSession()
Retrieves a Mail session from Tomcat's Resource Factory (JNDI)


sendMessageWithAttachment

public static void sendMessageWithAttachment(String from,
                                             String[] to,
                                             String[] cc,
                                             String subject,
                                             String content,
                                             String mimeType,
                                             File attachment)
                                      throws MessagingException
This method is used to send a Message with an attachment.

Parameters:
from - e-mail address of sender
to - e-mail address(es) of recipients
subject - subject of e-mail
content - the body of the e-mail
mimeType - type of message, i.e. text/plain or text/html
Throws:
MessagingException - the exception to indicate failure

sendMessage

public static void sendMessage(String from,
                               String[] to,
                               String[] cc,
                               String subject,
                               String content,
                               String mimeType)
                        throws MessagingException
This method is used to send a Message with a pre-defined mime-type.

Parameters:
from - e-mail address of sender
to - e-mail address(es) of recipients
subject - subject of e-mail
content - the body of the e-mail
mimeType - type of message, i.e. text/plain or text/html
Throws:
MessagingException - the exception to indicate failure

sendTextMessage

public static void sendTextMessage(String from,
                                   String[] to,
                                   String[] cc,
                                   String subject,
                                   String content)
                            throws MessagingException
This method is used to send a Text Message.

Parameters:
from - e-mail address of sender
to - e-mail addresses of recipients
subject - subject of e-mail
content - the body of the e-mail
Throws:
MessagingException - the exception to indicate failure

sendTextMessage

public static void sendTextMessage(String from,
                                   String to,
                                   String cc,
                                   String subject,
                                   String content)
                            throws MessagingException
This method overrides the sendTextMessage to specify only one sender, rather than an array of senders.

Parameters:
from - e-mail address of sender
to - e-mail address of recipients
subject - subject of e-mail
content - the body of the e-mail
Throws:
MessagingException - the exception to indicate failure

sendMessage

public static void sendMessage(String from,
                               String to,
                               String cc,
                               String subject,
                               String content,
                               String mimeType)
                        throws MessagingException
This method allows you to specify the mimeType as part of the method call.

Throws:
MessagingException

sendMessage

public static void sendMessage(String from,
                               String to,
                               String cc,
                               String subject,
                               String content,
                               String mimeType,
                               File attachment)
                        throws MessagingException
Convenience method for sending messages with attachments.

Throws:
MessagingException

sendHTMLMessage

public static void sendHTMLMessage(String from,
                                   String[] to,
                                   String[] cc,
                                   String subject,
                                   String content)
                            throws MessagingException
This method is used to send a HTML Message

Parameters:
from - e-mail address of sender
to - e-mail address(es) of recipients
subject - subject of e-mail
content - the body of the e-mail
Throws:
MessagingException - the exception to indicate failure

sendHTMLMessage

public static void sendHTMLMessage(String from,
                                   String to,
                                   String cc,
                                   String subject,
                                   String content)
                            throws MessagingException
This method overrides the sendHTMLMessage to specify only one sender, rather than an array of senders.

Parameters:
from - e-mail address of sender
to - e-mail address of recipients
subject - subject of e-mail
content - the body of the e-mail
Throws:
MessagingException - the exception to indicate failure


Copyright © 2002-2004