O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

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 15. 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 clients, but, in an enterprise setting, the primary application for JavaMail is to add electronic mail capability to large applications. For example, a Java servlet can use JavaMail to implement a web-based mail reading system, send confirmations and notifications, receive commands from users, or even communicate with middleware.

Sun included a basic SMTP email class in the first version of the JDK. However, because this class could only send email, and was available only 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.3, fills this niche, giving Java applications a complete mail and messaging framework. JavaMail has been part of J2EE since Version 1.2, and JavaMail 1.3 is included in J2EE 1.4.

Strictly 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 of ...

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