Difference between revisions of "JBoss mail configuration"

From OpenKM Documentation
Jump to: navigation, search
Line 93: Line 93:
 
</source>
 
</source>
  
== Addin PKI certificate ==
+
== Adding PKI certificate ==
 
Some mail servers need you have installed PKI certificate on server, if you have not it installed you'll got some error like this:
 
Some mail servers need you have installed PKI certificate on server, if you have not it installed you'll got some error like this:
  

Revision as of 16:08, 23 May 2011

OpenKM is a J2EE application deployed in JBoss application server. Some parameters have a default configuration that fit common user requirements but others depends on specific user configuration.


Nota clasica.png For specific JBoss issues, visit http://jboss.org/community/docs/DOC-10376.

OpenKM sometimes send mail to users (because they have subscribed a document or folder, for example) and you have to check that this mail configuration is correct. If you edit the file $JBOSS_HOME/server/default/deploy/mail-service.xml:

$ vim $JBOSS_HOME/server/default/deploy/mail-service.xml

You will see something like this:

<mbean code="org.jboss.mail.MailService" name="jboss:service=OpenKM">
  <attribute name="JNDIName">java:/mail/OpenKM</attribute>
  <attribute name="User">nobody</attribute>
  <attribute name="Password">password</attribute>
  <attribute name="Configuration">
    <!-- A test 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.your-domain.com "/>
      <!-- Change to the SMTP gateway server -->
      <property name="mail.smtp.host" value="smtp.your-domain.com "/>
      <!-- The mail server port -->
      <property name="mail.smtp.port" value="25"/>
      <!-- Change to the address mail will be from -->
      <property name="mail.from" value="noreply@your-domain.com"/>
      <!-- Enable debugging output from the javamail classes -->
      <property name="mail.debug" value="false"/>
    </configuration>
  </attribute>
  <depends>jboss:service=Naming</depends>
</mbean>

Typically you only have to configure these parameters:

  • mail.smtp.host: this is the host where is located your mail server. Can be localhost if you have a local mail server installed (like Postfix)
  • mail.from: all the mails send by OpenKM will be from this mail. Can be in the form of noreply@your-domain.com.

But it depends on you own mail configuration. If you run intro troubles, set the parameter mail.debug to true and revise the JBoss log.

$ tail -f $JBOSS_HOME/server/default/log/server.log

For more info, read http://community.jboss.org/wiki/JavaMail.

Confguration for SMTP authentication

When we want to use a mail server via a secured SMTP with authentication we should some changes to mail-service.xml file (used an example using the SMTP server gmail.com).

<mbean code="org.jboss.mail.MailService" name="jboss:service=OpenKM">
  <attribute name="JNDIName">java:/mail/OpenKM</attribute>
  <attribute name="User">USUARIO@gmail.com</attribute>
  <attribute name="Password">PASSWORD</attribute>
  <attribute name="Configuration">
    <!-- A test 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="USUARIO@gmail.com"/>

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

      <!-- Change to the SMTP gateway server -->
      <property name="mail.smtp.host" value="smtp.gmail.com"/>
      <property name="mail.smtp.starttls.enable" value="true" />
      <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory" />

      <!-- The mail server port -->
      <property name="mail.smtp.port" value="465"/>
      <property name="mail.smtp.socketFactory.port" value="465" />

      <!-- Change to the address mail will be from  -->
      <property name="mail.from" value="USUARIO@gmail.com"/>
      <property name="mail.smtp.user" value="USUARIO@gmail.com"/>
      <property name="mail.smtp.password" value="PASSWORD"/>
      <property name="mail.smtp.auth" value="true"/>

      <!-- Enable debugging output from the javamail classes -->
      <property name="mail.debug" value="false"/>
    </configuration>
  </attribute>
  <depends>jboss:service=Naming</depends>
</mbean>

Adding PKI certificate

Some mail servers need you have installed PKI certificate on server, if you have not it installed you'll got some error like this:

ERROR [STDERR] javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

In this case must be installed the certificate.

  • Download the file and extract files
  • Execute application
java InstallCert serverName
  • Select option '1', now has been generated a file called jssecacerts
  • Overwrite jssecacerts to /usr/lib/jvm/java-6-sun/jre/lib/security/cacerts
  • You must restart jboss to it takes some effect

For more information about installing certificate, read http://blogs.oracle.com/gc/entry/unable_to_find_valid_certification


For more info read: