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 popular mail-related protocols and a set of helper classes specifically designed to work with email on the Internet. Since JavaMail includes built-in support for Multipurpose Internet Mail Extensions (MIME)[*]-formatted messages, this communication can be extremely rich, opening up a range of new possibilities for large-scale applications.

[*] MIME was originally defined in RFCs 1521 and 1522. These have been replaced by RFCs 2045 through 2049. The complete set, along with additional information, related RFCs, and helpful links, is available at http://www.nacs.uci.edu/indiv/ehood/MIME/MIME.html.



Java Enterprise in a Nutshell
Java Enterprise in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596101422
EAN: 2147483647
Year: 2004
Pages: 269

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net