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 ...
Get Java Enterprise in a Nutshell, Third Edition 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.