- Navigate to:
- Open the file: mail-service.xml in your favorite text editor
- Edit it as follows:
$JBOSS_HOME/server/default/deploy
<server>
<mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">${username}@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="${username}@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.auth" value="true" />
<property name="mail.smtp.user" value="${username}@gmail.com" />
<property name="mail.smtp.password" value="${password}" />
<property name="mail.smtp.ssl.enable" value="true" />
<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" />
<!-- Change the default address mail will be from -->
<property name="mail.from" value="${username}@gmail.com" />
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="false" />
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>
NOTE: If you are using Google Apps, simply change the gmail.com extension to your-domain.com.
2 comments:
Did you face a problem of SSLSocketFactory not getting loaded by Baseclassloader. Do you know where your jsse.jar is located. I suppose the base classloader is not able to load SSL factory.
Could you please let me know how I can access these properties being set in mail-service.xml from a class used to send the mail.
Thanks in advance.
Post a Comment