JBossWiki : JavaMail
Wiki Home: JavaMail [EN]
[Permalink]
[Recent Changes]
[History]
[RSS Feed][RDF Feed][Atom Feed][Print]

Your trail: JavaMail

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 name="mail.transport.protocol" value="smtp"/>

          <!-- Change to the user who will receive mail  -->
          <property name="mail.user" value="nobody"/>

          <!-- Change to the mail server  -->
          <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>

          <!-- Enable debugging output from the javamail classes -->
          <property name="mail.debug" value="false"/>
     </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


Other languages:

Log in to make links between pages

The page last changed on Thu May 17 13:34:45 EDT 2007 by carjat