Version 9

    Adding JavaMail support

    The JBossAS deploy/mail-service.xml configures a JavaMail session binding into JNDI. Its configurable attributes are:

     

    • JNDIName - the JNDI name under which the javax.mail.Session is bound.

    • User - Username used to connect to a mail server

    • Password - Password used to connect to a mail server

    • Configuration - a container for an xml fragment that specifies the JavaMail provider properties passed to the javax.mail.Session.getInstance() factory method. The format is shown here:

        <attribute name="Configuration">
           <configuration>
              <!-- Change to your mail server prototocol -->
              <property name="mail.store.protocol" value="pop3"></property>
              <property name="mail.transport.protocol" value="smtp"></property>
    
              <!-- Change to the user who will receive mail  -->
              <property name="mail.user" value="nobody"></property>
    
              <!-- Change to the mail server  -->
              <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"></property>
    
              <!-- Enable debugging output from the javamail classes -->
              <property name="mail.debug" value="false"></property>
         </configuration>
       </attribute>
    

     

    Hints

    • If you want to use SMTP authentication you'll need to add <property name="mail.smtp.auth" value="true"/>

    • To use TLS - which secures the transport layer (i.e. authentication data but not the mail itself) - for SMTP you'll need to add <property name="mail.smtp.starttls.enable" value="true"/>

    • If you are using TLS, the certificate authority of the certificate used by the mail server should be present in the cacerts keystore (see HOWTO add a certificate authority to the keystore here)

     

    Possible configuration properties