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.