8.7. Deploying JavaMail on JBoss
We now need to configure JBoss so we can use it as a JavaMail provider. JBoss
Example 8-8. mail-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<server>
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">yourUserId</attribute>
<attribute name="Password">yourPassword</attribute>
<attribute name="Configuration">
<configuration>
<!-- Set the protocol for your mail server -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Configure the POP3 Server -->
<property name="mail.pop3.host" value="yourIsp.pop3.host"/>
<!-- Configure the SMTP gateway server -->
<property name="mail.smtp.host" value="yourIsp.smtp.host "/>
<property name="mail.smtp.port" value="25"/>
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
</mbean>
</server>
The mail-service.xml file configures a JavaMail Session with the email account properties that you use to connect with your email service provider:
These are standard JavaMail properties, and you can find a complete listing of them in Appendix A of the JavaMail Design Specification at: http://java.sun.com/products/javamail/JavaMail-1.2.pdf.
The example above uses
|
8.8. JavaMail ChecklistBefore we move on to test the JAW Motors application's new email functionality, let's recap what we've done to implement JavaMail:
|
8.9. Testing the Credit Check Notification Email
Now that we've developed and deployed JavaMail code to send an email notification message to the
Click on the "Run Credit Check" link on the JAW Motors home page, enter data on the "Run Credit Check" form, and press the "Submit Credit Info" button. You should be routed back to the main page, and in a minute or two you should see a message that looks like this in your email client's Inbox: From: credit.check@jbossatwork.com To: yourName@host.domain Subject: Credit Check Result Pass Credit Check
The credit check
|