org.blojsom.plugin.email
Class EmailUtils

java.lang.Object
  extended byorg.blojsom.plugin.email.EmailUtils

public class EmailUtils
extends java.lang.Object

Send Email (SMTP) Plugin Support Utilities. This class is used to put email into the plugin context for the email plugin to get at

Version:
$Id: EmailUtils.java,v 1.10 2006/01/04 16:53:00 czarneckid Exp $
Author:
Mark Lussier

Field Summary
static java.lang.String BLOJSOM_OUTBOUNDMAIL
          Variable name for the message arraylist in the context on the plugin chain
 
Constructor Summary
EmailUtils()
           
 
Method Summary
static javax.mail.internet.InternetAddress constructRecipientAddress(java.lang.String recipient, java.lang.String defaultname, java.lang.String defaultemail)
          Helper method to create the recipient email address for a giving email message.
static javax.mail.internet.InternetAddress constructSenderAddress(java.lang.String sender, java.lang.String defaultname, java.lang.String defaultemail)
          Helper method to create the sender email address for a giving email message.
static void notifyBlogAuthor(java.lang.String subject, java.lang.String message, java.util.Map context, java.lang.String recipient)
          Send notification email to the Blog Author.
static void sendMailMessage(javax.mail.Session mailsession, EmailMessage emailmessage, javax.mail.internet.InternetAddress defaultaddress)
          Send an Email Message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOJSOM_OUTBOUNDMAIL

public static final java.lang.String BLOJSOM_OUTBOUNDMAIL
Variable name for the message arraylist in the context on the plugin chain

See Also:
Constant Field Values
Constructor Detail

EmailUtils

public EmailUtils()
Method Detail

notifyBlogAuthor

public static void notifyBlogAuthor(java.lang.String subject,
                                    java.lang.String message,
                                    java.util.Map context,
                                    java.lang.String recipient)
Send notification email to the Blog Author. This utilizes two values in blojsom.properties to determine the name and email address to use

Parameters:
subject - Subject of the message being sent
message - The message text
context - The context Map for putting the messages
recipient - Recipient e-mail (if available)

constructRecipientAddress

public static javax.mail.internet.InternetAddress constructRecipientAddress(java.lang.String recipient,
                                                                            java.lang.String defaultname,
                                                                            java.lang.String defaultemail)
                                                                     throws java.io.UnsupportedEncodingException,
                                                                            javax.mail.internet.AddressException
Helper method to create the recipient email address for a giving email message. This will default to the blog author is no recipient email is provided.

Parameters:
recipient - Email address of message recipient
defaultname - Default recipient name
defaultemail - Default recipient email
Returns:
properly formatted InternetAddress instance
Throws:
java.io.UnsupportedEncodingException
javax.mail.internet.AddressException

constructSenderAddress

public static javax.mail.internet.InternetAddress constructSenderAddress(java.lang.String sender,
                                                                         java.lang.String defaultname,
                                                                         java.lang.String defaultemail)
                                                                  throws java.io.UnsupportedEncodingException,
                                                                         javax.mail.internet.AddressException
Helper method to create the sender email address for a giving email message. This will default to the blog author is no recipient email is provided.

Parameters:
sender - Email address of message sender
defaultname - Default sender name
defaultemail - Default email name
Returns:
properly formatted InternetAddress instance
Throws:
java.io.UnsupportedEncodingException
javax.mail.internet.AddressException

sendMailMessage

public static void sendMailMessage(javax.mail.Session mailsession,
                                   EmailMessage emailmessage,
                                   javax.mail.internet.InternetAddress defaultaddress)
Send an Email Message

Parameters:
mailsession - Session Inastance
emailmessage - EmailMessage Instance
defaultaddress - InternetAddress Instance of Recipient/Sender