org.melati.util
Class Email

Package class diagram package Email
java.lang.Object
  extended by org.melati.util.Email

public final class Email
extends Object

Send an email to one or more recipients with or without attachments.


Field Summary
static String SMTPSERVER
          Property key for the SMTP server.
 
Method Summary
static String mailAddress(String name, String email)
           
static void send(String smtpServer, String from, String to, String replyto, String subject, String text)
          Send the email.
static void sendAsHtmlWithAttachments(String smtpServer, String from, String to, String replyto, String subject, String plainText, String htmlText, File[] referenced, File[] attachments)
          Send HTML message with attachments.
static void sendToList(String smtpServer, String from, String[] toList, String replyto, String subject, String message)
          Send the email to a list of recipients.
static void sendWithAttachments(String smtpServer, String from, String to, String replyto, String subject, String text, File[] attachments)
          Send message with attachments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMTPSERVER

public static String SMTPSERVER
Property key for the SMTP server.

Method Detail

send

public static void send(String smtpServer,
                        String from,
                        String to,
                        String replyto,
                        String subject,
                        String text)
                 throws EmailException,
                        IOException
Send the email.

Parameters:
smtpServer - name of SMTP server to use
from - email address and optionally name of sender
to - email address and optionally name of recipient
replyto - email address and optionally name to reply to
subject - subject of message
text - text body of email
Throws:
EmailException
IOException

sendToList

public static void sendToList(String smtpServer,
                              String from,
                              String[] toList,
                              String replyto,
                              String subject,
                              String message)
                       throws EmailException,
                              IOException
Send the email to a list of recipients.

Parameters:
smtpServer - name of SMTP server to use
from - email address and optionally name of sender
toList - list of email addresses and optionally names of recipients
replyto - email address and optionally name to reply to
subject - subject of message
message - text body of email
Throws:
EmailException
IOException

sendWithAttachments

public static void sendWithAttachments(String smtpServer,
                                       String from,
                                       String to,
                                       String replyto,
                                       String subject,
                                       String text,
                                       File[] attachments)
                                throws EmailException,
                                       IOException
Send message with attachments.

Parameters:
smtpServer - name of SMTP server to use
from - email address and optionally name of sender
to - email address and optionally name of recipient
replyto - email address and optionally name to reply to
subject - subject of message
text - text body of email
attachments - Array of files to attach
Throws:
EmailException
IOException

sendAsHtmlWithAttachments

public static void sendAsHtmlWithAttachments(String smtpServer,
                                             String from,
                                             String to,
                                             String replyto,
                                             String subject,
                                             String plainText,
                                             String htmlText,
                                             File[] referenced,
                                             File[] attachments)
                                      throws EmailException,
                                             IOException
Send HTML message with attachments.

Parameters:
smtpServer - name of SMTP server to use
from - email address and optionally name of sender
to - email address and optionally name of recipient
replyto - email address and optionally name to reply to
subject - subject of message
plainText - text body of email
htmlText - HTML body of email
referenced - Array of Files referenced withing the HTML body
attachments - Array of files to attach
Throws:
EmailException
IOException

mailAddress

public static String mailAddress(String name,
                                 String email)
Returns:
a fancy email address


Copyright © 2000-2010 PanEris. All Rights Reserved.