O'Reilly logo

Java Enterprise in a Nutshell, Second Edition by David Flanagan, Jim Farley, William Crawford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. JavaMail

The JavaMail APIs provide a platform and protocol-independent framework to build Java-based mail and messaging applications with a particular focus on Internet email. JavaMail can be used to build mail user agent (MUA) programs. This includes such applications as mail clients, but, in an enterprise setting, the primary application for JavaMail might be to add electronic mail capability to existing and new applications. For example, a Java servlet can use JavaMail to implement a web-based mail reading system, to send confirmations and notifications, receive commands from users, or even communicate with middleware.

Sun Microsystems, Inc. included a basic SMTP email class in the first version of the JDK. However, because this class could only send email, and was only available with Sun’s implementation of the JDK, developers who wished to include more advanced electronic mail capability into their applications generally needed to start from scratch. The JavaMail API, first introduced in early 1998 and now in Version 1.2, fills this niche, giving Java applications a complete mail and messaging framework.

Frankly speaking, the JavaMail API isn’t really an email API at all. The JavaMail classes provide an interface to a generic set of messaging functions for creating, storing, and transporting messages. Developers can extend these classes to implement custom transport protocols and develop standardized mail applications. As an add-on, the distribution includes implementations ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required