Chapter 8. JavaMail
In the previous chapter, we upgraded the JAW Motors application by
adding the ability to run a credit check on a customer using JMS messaging
and an MDB. We didnât want to make the user wait a long time for the
credit verification to complete, so we deferred this process to the
background. As youâll recall, the CreditCheckProcessor
MDB received the credit
check message, invoked a simulated external credit verification service,
and printed the result. But this wasnât completely satisfying because the
user on the web site didnât know the final result of the credit
verification process. In this chapter, weâll upgrade the MDB to use the
JavaMail API for sending an email notification message to the user. Along
the way weâll show how to deploy and configure JavaMail on JBoss.
JavaMail 1.2 is a J2EE API that enables Java programs to send and receive email messages. With JavaMail, you can send text or HTML messages, and you have the option to include Multipurpose Internet Mail Extensions (MIME) attachments. To keep things simple, weâll send text messages without attachments.
Letâs start by briefly reviewing where we left off in the last chapter.
Running a Credit Check
If youâll recall, we added a âRun Credit Checkâ link to the JAW Motors homepage as shown in Figure 8-1.
When the user clicks on the âRun Credit Checkâ ...
Get JBoss at Work: A Practical Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.