org.jboss.soa.esb.actions.routing.email
Class Emailer

java.lang.Object
  extended by org.jboss.soa.esb.actions.routing.email.Emailer

public class Emailer
extends java.lang.Object

General Emailer used for both notifiations and router.

This code was lifted from NotifyEmail. Configuration properties:
  • host The host name of the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.host' in jbossesb-properties.xml.
  • port The port for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.port' in jbossesb-properties.xml.
  • username The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml.
  • password The password for the above username on the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.password' in jbossesb-properties.xml
  • username The username for the SMTP server. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.user' in jbossesb-properties.xml
  • auth If true will attempt to authenticate the user using the AUTH command. If not specified will default to the property 'org.jboss.soa.esb.mail.smtp.auth' in jbossesb-properties.xml
  • msgAttachmentName filename of an attachment containing the message payload (optional). If not specified the message payload will be included in the message body.
  • Note that all of the properties except attachments can be specified jboss-esb.xml can be overridden by specifying the same properties on the ESB Message object instance passed to this classes sendNotification method.

    Author:
    Daniel Bevenius

    Constructor Summary
    Emailer(ConfigTree config)
               
     
    Method Summary
    static void overrideSmtpProperties(Message message, ConfigTree configTree)
              Allows smtp overrides by setting properties on the passed-in message.
    protected  void sendEmail(ConfigTree messageParams, byte[] msgPayload)
              Send an email notification based on the supplied parameters.
     void sendEmail(ConfigTree config, java.lang.Object obj)
              Send an Email using Email() using p_o.toString() to fill in the message text
     void sendEmail(Message message)
              Send an Email using Email() using p_o.toString() to fill in the message text
     void sendEmail(java.lang.Object obj)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Emailer

    public Emailer(ConfigTree config)
            throws ConfigurationException
    Throws:
    ConfigurationException
    Method Detail

    sendEmail

    public void sendEmail(Message message)
                   throws MessageDeliverException
    Send an Email using Email() using p_o.toString() to fill in the message text

    Parameters:
    message - Object - This object's toString() method will supply contents of mail message
    Throws:
    MessageDeliverException

    sendEmail

    public void sendEmail(java.lang.Object obj)
                   throws MessageDeliverException
    Throws:
    MessageDeliverException

    sendEmail

    public void sendEmail(ConfigTree config,
                          java.lang.Object obj)
                   throws MessageDeliverException
    Send an Email using Email() using p_o.toString() to fill in the message text

    Parameters:
    message - Object - This object's toString() method will supply contents of mail message
    Throws:
    MessageDeliverException

    sendEmail

    protected void sendEmail(ConfigTree messageParams,
                             byte[] msgPayload)
                      throws javax.mail.internet.AddressException,
                             javax.mail.MessagingException,
                             java.io.IOException
    Send an email notification based on the supplied parameters.

    This method allows overriding for test purposes.

    Parameters:
    messageParams - Message parameters.
    message -
    Throws:
    java.io.IOException
    javax.mail.internet.AddressException
    javax.mail.MessagingException

    overrideSmtpProperties

    public static void overrideSmtpProperties(Message message,
                                              ConfigTree configTree)
    Allows smtp overrides by setting properties on the passed-in message. This could be populated by a previous action in an action pipline.

    Parameters:
    message - The ESB Message object that contains the overrides in its properties.
    configTree - The configTree the properties on the ESB Message object will override.