Difference between revisions of "JBoss mail configuration"

From OpenKM Documentation
Jump to: navigation, search
Line 48: Line 48:
  
 
For more info, read http://community.jboss.org/wiki/JavaMail.
 
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).
 +
 +
<source lang="xml">
 +
<mbean code="org.jboss.mail.MailService" name="jboss:service=OpenKM">
 +
  <attribute name="JNDIName">java:/mail/OpenKM</attribute>
 +
  <attribute name="User">USUARIO</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>
 +
</source>
  
 
[[Category: Installation Guide]]
 
[[Category: Installation Guide]]

Revision as of 09:55, 16 April 2010

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</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>