com.novell.nds.dirxml.util.mail
Class SendMail

java.lang.Object
  extended bycom.novell.nds.dirxml.util.mail.SendMail

public class SendMail
extends Object

A class to generate email notifications


Nested Class Summary
static class SendMail.EmailAddress
           
 
Constructor Summary
SendMail()
           
 
Method Summary
static byte[] encodeHTML(String input, String encoding)
          encode a string containing HTML to a byte array
static void generateEMail(String sGateway, String sFrom, String sReply, SendMail.EmailAddress[] toAddrs, String sSubject, String sMessage, String sUserID, String sPassword, String sEncoding, boolean bHtml)
          generate an email with the given recipients and parameters
static void generateEMail(String sGateway, String sFrom, String sReply, SendMail.EmailAddress[] toAddrs, String sSubject, String sMessage, String sUserID, String sPassword, String sEncoding, List customHeaders, boolean bHtml)
          generate an email with the given recipients and parameters
static void generateEMailFromTemplate(String sFrom, String sReply, SendMail.EmailAddress[] toAddrs, String sSubject, String sMsgTemplate, String sGateway, String sUserID, String sPassword, String sEncoding, Map hReplacementData, boolean bHtml)
          generate an email with the given recipients and parameters
static void generateEMailFromTemplate(String sFrom, String sReply, SendMail.EmailAddress[] toAddrs, String sSubject, String sMsgTemplate, String sGateway, String sUserID, String sPassword, String sEncoding, Map hReplacementData, List customHeaders, boolean bHtml)
          generate an email with the given recipients and parameters
protected static String simpleReplaceData(String value, Map hReplacementData)
          simple data replacement against a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SendMail

public SendMail()
Method Detail

generateEMail

public static void generateEMail(String sGateway,
                                 String sFrom,
                                 String sReply,
                                 SendMail.EmailAddress[] toAddrs,
                                 String sSubject,
                                 String sMessage,
                                 String sUserID,
                                 String sPassword,
                                 String sEncoding,
                                 boolean bHtml)
                          throws Exception
generate an email with the given recipients and parameters

Parameters:
sGateway - the SMTP server
sFrom - the SMTP from address
sReply - the SMTP reply-to address
toAddrs - array of recipient addresses and types
sSubject - the email subject
sMessage - the email message
sUserID - the SMTP user's account
sPassword - the SMTP user's password
sEncoding - encoding to use for message and subject (may be null)
bHtml - flag to send message as plain text or HTML
Throws:
Exception

generateEMail

public static void generateEMail(String sGateway,
                                 String sFrom,
                                 String sReply,
                                 SendMail.EmailAddress[] toAddrs,
                                 String sSubject,
                                 String sMessage,
                                 String sUserID,
                                 String sPassword,
                                 String sEncoding,
                                 List customHeaders,
                                 boolean bHtml)
                          throws Exception
generate an email with the given recipients and parameters

Parameters:
sGateway - the SMTP server
sFrom - the SMTP from address
sReply - the SMTP reply-to address
toAddrs - array of recipient addresses and types
sSubject - the email subject
sMessage - the email message
sUserID - the SMTP user's account
sPassword - the SMTP user's password
sEncoding - encoding to use for message and subject (may be null)
customHeaders - an List of Strings, each string containing a custom SMTP header line (may be null)
bHtml - flag to send message as plain text or HTML
Throws:
Exception

generateEMailFromTemplate

public static void generateEMailFromTemplate(String sFrom,
                                             String sReply,
                                             SendMail.EmailAddress[] toAddrs,
                                             String sSubject,
                                             String sMsgTemplate,
                                             String sGateway,
                                             String sUserID,
                                             String sPassword,
                                             String sEncoding,
                                             Map hReplacementData,
                                             boolean bHtml)
                                      throws Exception
generate an email with the given recipients and parameters

Parameters:
sFrom - the SMTP from address
sReply - the SMTP reply-to address
toAddrs - array of recipient addresses and types
sSubject - the email subject
sMsgTemplate - the email message template
sGateway - the SMTP server
sUserID - the SMTP user's account
sPassword - the SMTP user's password
sEncoding - encoding to use for message and subject (may be null)
hReplacementData - Map containing replacement data key/value pairs
bHtml - flag to send message as plain text or HTML
Throws:
Exception

generateEMailFromTemplate

public static void generateEMailFromTemplate(String sFrom,
                                             String sReply,
                                             SendMail.EmailAddress[] toAddrs,
                                             String sSubject,
                                             String sMsgTemplate,
                                             String sGateway,
                                             String sUserID,
                                             String sPassword,
                                             String sEncoding,
                                             Map hReplacementData,
                                             List customHeaders,
                                             boolean bHtml)
                                      throws Exception
generate an email with the given recipients and parameters

Parameters:
sFrom - the SMTP from address
sReply - the SMTP reply-to address
toAddrs - array of recipient addresses and types
sSubject - the email subject
sMsgTemplate - the email message template
sGateway - the SMTP server
sUserID - the SMTP user's account
sPassword - the SMTP user's password
sEncoding - encoding to use for message and subject (may be null)
hReplacementData - Map containing replacement data key/value pairs
customHeaders - an List of Strings, each string containing a custom SMTP header line (may be null)
bHtml - flag to send message as plain text or HTML
Throws:
Exception

encodeHTML

public static byte[] encodeHTML(String input,
                                String encoding)
                         throws IOException
encode a string containing HTML to a byte array

Parameters:
input - string to encode
encoding - encoding to use
Returns:
byte array containing the encoded string
Throws:
IOException

simpleReplaceData

protected static String simpleReplaceData(String value,
                                          Map hReplacementData)
simple data replacement against a string

Parameters:
value - input string
hReplacementData - Map containing replacement data key/value pairs
Returns:
value with replacementData substituted for tokens