Project Wonder 2.0

er.javamail
Class ERMailUtils

java.lang.Object
  extended byer.javamail.ERMailUtils

public class ERMailUtils
extends Object

ERMailUtils contains various utility method related to mail sending.

Version:
$Id: ERMailUtils.java,v 1.9 2004/04/05 22:36:01 maxmuller Exp $
Author:
Camille Troillard

Constructor Summary
ERMailUtils()
           
 
Method Summary
static NSArray convertInternetAddressesToNSArray(javax.mail.Address[] addressesArray)
          Method that converts Address [] loaded with either Address or InternetAddress objects to NSArray of String emails.
static javax.mail.internet.InternetAddress[] convertNSArrayToInternetAddresses(NSArray addrs)
          Method that converts NSArray of String emails to InternetAddress [].
static String encodeString(String string, String charset)
           
static WOComponent instantiatePage(String pageName, NSDictionary sessionDict)
          Augmented version of the method found in ERXApplication.
static void sendHTMLMail(ERMailDeliveryHTML delivery, String pageName, String alternatePageName, String emailFrom, String emailTo, String emailReplyTo, String subject)
          Use this method to send an HTML mail.
static void sendHTMLMail(String pageName, String alternatePageName, String emailFrom, String emailTo, String emailReplyTo, String subject)
          Use this method to send an HTML mail, but default mail delivery.
static void setDictionaryValuesInSession(NSDictionary dict, WOSession session)
          This method sets the values found in a dictionary into the session's state dictionary.
static ERMailDeliveryHTML sharedDeliverer()
          Accessor to the shared instance of a ERMailDeliveryHTML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERMailUtils

public ERMailUtils()
Method Detail

sharedDeliverer

public static ERMailDeliveryHTML sharedDeliverer()
Accessor to the shared instance of a ERMailDeliveryHTML.

Returns:
the ERMailDeliveryHTML singleton

instantiatePage

public static WOComponent instantiatePage(String pageName,
                                          NSDictionary sessionDict)
Augmented version of the method found in ERXApplication. Used to instantiate a WOComponent, typically outside of a session.

Parameters:
pageName - The name of the WOComponent that must be instantiated.
sessionDict - can be provided in order to set objects/keys in the newly created session of the component. This is useful when one want to preserve state when sending a mail.
Returns:
a newly instantiated WOComponent.

sendHTMLMail

public static void sendHTMLMail(ERMailDeliveryHTML delivery,
                                String pageName,
                                String alternatePageName,
                                String emailFrom,
                                String emailTo,
                                String emailReplyTo,
                                String subject)
Use this method to send an HTML mail.

Parameters:
delivery - the ERMailDeliveryHTML used to send the mail.
pageName - The name of the WOComponent that must be instantiated.
alternatePageName - The name of the WOComponent that represents for the text that must be displayed when an alternate plain text version of the mail needs to be provided.
emailFrom - the email address the mail is sent from
emailTo - the email address the mail is sent to
emailReplyTo - the email address where the mail must be replied-to.
subject - the subject of the mail

sendHTMLMail

public static void sendHTMLMail(String pageName,
                                String alternatePageName,
                                String emailFrom,
                                String emailTo,
                                String emailReplyTo,
                                String subject)
Use this method to send an HTML mail, but default mail delivery.

Parameters:
pageName - The name of the WOComponent that must be instantiated.
alternatePageName - The name of the WOComponent that represents for the text that must be displayed when an alternate plain text version of the mail needs to be provided.
emailFrom - the email address the mail is sent from
emailTo - the email address the mail is sent to
emailReplyTo - the email address where the mail must be replied-to.
subject - the subject of the mail

setDictionaryValuesInSession

public static void setDictionaryValuesInSession(NSDictionary dict,
                                                WOSession session)
This method sets the values found in a dictionary into the session's state dictionary. This method is useful when one want to transfer current session's state into a newly created session (for example when sending a mail whose page has been instantiated with ERMailUtils.instantiatePage or ERXApplication.instantiatePage.)

Parameters:
dict - a NSDictionary value containing the values we want to set in the session parameter.
session - a WOSession value that will receive the values contained in the dict parameter.

encodeString

public static String encodeString(String string,
                                  String charset)

convertNSArrayToInternetAddresses

public static javax.mail.internet.InternetAddress[] convertNSArrayToInternetAddresses(NSArray addrs)
                                                                               throws javax.mail.internet.AddressException
Method that converts NSArray of String emails to InternetAddress [].

Parameters:
addrs - a NSArray value
Returns:
an InternetAddress[] value
Throws:
javax.mail.internet.AddressException - if an error occurs

convertInternetAddressesToNSArray

public static NSArray convertInternetAddressesToNSArray(javax.mail.Address[] addressesArray)
                                                 throws javax.mail.internet.AddressException
Method that converts Address [] loaded with either Address or InternetAddress objects to NSArray of String emails.

Note that this method will not only accept Address [] but also InternetAddress [].

Parameters:
addressesArray - an Address[] value
Returns:
a NSArray value
Throws:
javax.mail.internet.AddressException - if an error occurs

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.