Class MailSender

  • All Implemented Interfaces:
    IConfigurable, IConfigurationAware, INamedObject, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class MailSender
    extends MailSenderBase
    sender that sends a mail specified by an XML message.

    Sample email.xml:

              <recipient type="to">***</recipient>
              <recipient type="cc">***</recipient>
           <from name="*** ***">***</from>
           <subject>This is the subject</subject>
           <message>This is the message</message>
           <messageType>text/plain</messageType><!-- Optional -->
           <messageBase64>false</messageBase64><!-- Optional -->
           <charset>UTF-8</charset><!-- Optional -->
              <attachment name="filename1.txt">This is the first attachment</attachment>
              <attachment name="filename2.pdf" base64="true">JVBERi0xLjQKCjIgMCBvYmoKPDwvVHlwZS9YT2JqZWN0L1N1YnR5cGUvSW1...vSW5mbyA5IDAgUgo+PgpzdGFydHhyZWYKMzQxNDY2CiUlRU9GCg==</attachment>
              <attachment name="filename3.pdf" url="file:/c:/filename3.pdf"/>
              <attachment name="filename4.pdf" sessionKey="fileContent"/>
           </attachments><!-- Optional -->

    Notice: the XML message must be valid XML. Therefore, especially the message element must be plain text or be wrapped as CDATA. Example:

        <message><![CDATA[<h1>This is a HtmlMessage</h1>]]></message>

    The sessionKey attribute for attachment can contain an inputstream or a string. Other types are not supported at this moment.

    The attribute order for attachments is as follows:

    1. sessionKey
    2. url
    3. value of the attachment element

    The base64 attribute is only used when the value of the PipeLineSession variable sessionKey is a String object or when the value of the attachment element is used. If base64=true then the value will be decoded before it's used.

    Compilation and Deployment Note: mail.jar (v1.2) and activation.jar must appear BEFORE j2ee.jar. Otherwise errors like the following might occur: NoClassDefFoundException: com/sun/mail/util/MailDateFormat

    Johan Verrips, Gerrit van Brakel