Difference between revisions of "JBoss mail configuration"

From OpenKM Documentation
Jump to: navigation, search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
+
OpenKM is a J2EE application deployed in a JBoss application server. Some parameters have a default configuration that fit common user requirements but others depend on specific user configuration.
  
 
{{Note|For specific JBoss issues, visit http://jboss.org/community/docs/DOC-10376.}}
 
{{Note|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'':
+
OpenKM sometimes sends emails to users (because they have subscribed a document or folder, for example) and you have to check that this email 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
 
  $ vim $JBOSS_HOME/server/default/deploy/mail-service.xml
Line 40: Line 40:
 
Typically you only have to configure these parameters:
 
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.smtp.host''': this is the host where your mail server is located. 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.
+
* '''mail.from''': all the mails sent by OpenKM will be from this email address. 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.
+
But it depends on you own email configuration. If you run into problems, set the parameter '''mail.debug''' to ''true'' and review the JBoss log.
  
 
  $ tail -f $JBOSS_HOME/server/default/log/server.log
 
  $ tail -f $JBOSS_HOME/server/default/log/server.log
Line 49: Line 49:
 
For more info, read http://community.jboss.org/wiki/JavaMail.
 
For more info, read http://community.jboss.org/wiki/JavaMail.
  
== Confguration for SMTP authentication ==
+
== Configuration 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).
+
When we want to use a mail server via a secured SMTP server with authentication we should make some changes to mail-service.xml file (an example using the SMTP server gmail.com).
  
 
<source lang="xml">
 
<source lang="xml">
Line 92: Line 92:
 
</mbean>
 
</mbean>
 
</source>
 
</source>
 +
 +
== Adding PKI certificate ==
 +
Some mail servers need you to have installed a PKI certificate on the server. If you don't have it installed you'll get 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, you must install the certificate.
 +
 +
* Download the file [[file:InstallCert.java‎]]
 +
* Execute application
 +
 +
java InstallCert serverName
 +
 +
* Select option '1'. A file called jssecacerts is generated
 +
* Overwrite jssecacerts to /usr/lib/jvm/java-6-sun/jre/lib/security/cacerts ( the path depends on your OS server and jdk version )
 +
* You must restart jboss for this to take effect
 +
 +
For more information about installing certificates, read:
 +
* http://blogs.oracle.com/gc/entry/unable_to_find_valid_certification
 +
* http://www.grim.se/guide/jre-cert
  
 
For more info read:
 
For more info read:

Latest revision as of 13:29, 10 November 2011

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


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

OpenKM sometimes sends emails to users (because they have subscribed a document or folder, for example) and you have to check that this email 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 your mail server is located. Can be localhost if you have a local mail server installed (like Postfix)
  • mail.from: all the mails sent by OpenKM will be from this email address. Can be in the form of noreply@your-domain.com.

But it depends on you own email configuration. If you run into problems, set the parameter mail.debug to true and review the JBoss log.

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

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

Configuration for SMTP authentication

When we want to use a mail server via a secured SMTP server with authentication we should make some changes to mail-service.xml file (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 to have installed a PKI certificate on the server. If you don't have it installed you'll get 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, you must install the certificate.

java InstallCert serverName
  • Select option '1'. A file called jssecacerts is generated
  • Overwrite jssecacerts to /usr/lib/jvm/java-6-sun/jre/lib/security/cacerts ( the path depends on your OS server and jdk version )
  • You must restart jboss for this to take effect

For more information about installing certificates, read:

For more info read: