org.jboss.soa.esb.notification
Class NotifyEmail

java.lang.Object
  extended by org.jboss.soa.esb.notification.NotificationTarget
      extended by org.jboss.soa.esb.notification.NotifyEmail

public class NotifyEmail
extends NotificationTarget

This class will send an e-mail using the Email class.

Example configuration:

<target class="NotifyEmail" 
    host=”localhost”
    port=”8801"
    username=”smtpUsername"
    password=”smtpPassword"
    auth=”true"
    from=”person@somewhere.com”
    sendTo=”person@elsewhere.com”
    subject=”theSubject”>
    msgAttachmentName=”theSubject”>
    <attachment>attachThisFile.txt</attachment>
 </target>
 
  • 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: Heuristica - Buenos Aires - Argentina

    Version:
    1.0

    Field Summary
     
    Fields inherited from class org.jboss.soa.esb.notification.NotificationTarget
    m_oParms, PRM_NOTIF_CLASS
     
    Constructor Summary
    NotifyEmail(ConfigTree configTree)
              Instantiate a NotifyEmail object using the information contained in <arg 1>
    NotifyEmail(ConfigTree config, Emailer emailer)
               
     
    Method Summary
    protected  void overrideSmtpProperties(Message message, ConfigTree configTree)
              Deprecated. Use Emailer.overrideSmtpProperties(Message, ConfigTree) instead
    protected  void sendEmailNotification(ConfigTree messageParams, byte[] msgPayload)
              Send an email notification based on the supplied parameters.
     void sendNotification(Message message)
              Send an Email using Email() using p_o.toString() to fill in the message text
     
    Methods inherited from class org.jboss.soa.esb.notification.NotificationTarget
    fromParams
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    NotifyEmail

    public NotifyEmail(ConfigTree configTree)
                throws ConfigurationException
    Instantiate a NotifyEmail object using the information contained in <arg 1>

    Parameters:
    configTree - ConfigTree - See attributes and structure needed for the Email() constructor - The MESSAGE attribute will be filled in at sendNotification(Serializable) time
    Throws:
    ConfigurationException
    See Also:
    sendNotification(Message)

    NotifyEmail

    public NotifyEmail(ConfigTree config,
                       Emailer emailer)
    Method Detail

    sendNotification

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

    Specified by:
    sendNotification in class NotificationTarget
    Parameters:
    message - Object - This object's toString() method will supply contents of mail message
    Throws:
    NotificationException - - invoke Exception.getMessage() at runtime for this object
    See Also:
    ConfigTree

    overrideSmtpProperties

    protected void overrideSmtpProperties(Message message,
                                          ConfigTree configTree)
    Deprecated. Use Emailer.overrideSmtpProperties(Message, ConfigTree) instead

    Allows smtp overrides by setting properties on the passed-in message. This could be populated by a previsous 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.

    sendEmailNotification

    protected void sendEmailNotification(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