org.tigris.scarab.util
Class Email

java.lang.Object
  extended byorg.apache.fulcrum.template.TemplateEmail
      extended byorg.tigris.scarab.util.Email

public class Email
extends org.apache.fulcrum.template.TemplateEmail

Sends a notification email.

Version:
$Id: Email.java 10366 2006-11-29 18:38:43Z ronvoe122 $
Author:
Jon Scott Stevens, Elicia David, John McNally

Field Summary
static org.apache.log4j.Logger log
           
 
Constructor Summary
Email()
           
 
Method Summary
static ScarabUser getArchiveUser()
          returns the dummy user which indicates that an Email should be sent to the archive Email addresses
static java.lang.String getCharset(java.util.Locale locale)
          Returns a charset for the given locale that is generally preferred by email clients.
protected  java.lang.String handleRequest()
          Override the super.handleRequest() and process the template our own way.
static boolean isArchiveUser(ScarabUser user)
          Checks if a user is the dummy user which indicates that an Email should be sent to the archive Email addresses
static void sendEmail(EmailContext context, Module module, java.lang.Object fromUser, java.lang.Object replyToUser, java.util.Collection toUsers, java.util.Collection ccUsers, java.lang.String template)
          Sends email to multiple recipients.
static void sendEmail(EmailContext context, Module module, java.lang.Object fromUser, java.lang.Object replyToUser, ScarabUser toUser, java.lang.String template)
          Sends email to a single recipient.
 
Methods inherited from class org.apache.fulcrum.template.TemplateEmail
addCc, addHeader, addReplyTo, addTo, getCCEmail, getCCList, getCCName, getCharSet, getContext, getFromEmail, getFromName, getHeadersList, getReplyToList, getSubject, getTemplate, getToEmail, getToList, getToName, getWordWrap, send, sendMultiple, setCC, setCharset, setContext, setFrom, setSubject, setTemplate, setTo, setToList, setWordWrap, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static org.apache.log4j.Logger log
Constructor Detail

Email

public Email()
Method Detail

sendEmail

public static void sendEmail(EmailContext context,
                             Module module,
                             java.lang.Object fromUser,
                             java.lang.Object replyToUser,
                             ScarabUser toUser,
                             java.lang.String template)
                      throws java.lang.Exception
Sends email to a single recipient. Throws an Excetion, if it fails to send the email for any reason.

Throws:
java.lang.Exception

sendEmail

public static void sendEmail(EmailContext context,
                             Module module,
                             java.lang.Object fromUser,
                             java.lang.Object replyToUser,
                             java.util.Collection toUsers,
                             java.util.Collection ccUsers,
                             java.lang.String template)
                      throws java.lang.Exception
Sends email to multiple recipients. Throws an Exception, if it fails to send the email for any reason.

Throws:
java.lang.Exception

isArchiveUser

public static boolean isArchiveUser(ScarabUser user)
Checks if a user is the dummy user which indicates that an Email should be sent to the archive Email addresses


getArchiveUser

public static ScarabUser getArchiveUser()
                                 throws org.apache.torque.TorqueException
returns the dummy user which indicates that an Email should be sent to the archive Email addresses

Throws:
org.apache.torque.TorqueException

handleRequest

protected java.lang.String handleRequest()
                                  throws org.apache.fulcrum.ServiceException
Override the super.handleRequest() and process the template our own way. This could have been handled in a more simple way, which was to create a new service and associate the emails with a different file extension which would have prevented the need to override this method, however, that was discovered after the fact and it also seemed to be a bit more work to change the file extension.

Throws:
org.apache.fulcrum.ServiceException

getCharset

public static java.lang.String getCharset(java.util.Locale locale)
Returns a charset for the given locale that is generally preferred by email clients. If not specified by the property named by ScarabConstants.DEFAULT_EMAIL_ENCODING_KEY, ask the MimeTypeService for a good value (except for Japanese, which always uses the encoding ISO-2022-JP).

Parameters:
locale - a Locale value
Returns:
a String value


Copyright © 2000-2004 Tigris.org. All Rights Reserved.