O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

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

The Java Mail API

Although it is nice to be able to write your own Java routines to speak the various email protocols, it can get pretty tedious, too. The SMTPSession and POP3Session classes you saw earlier in this chapter don't handle attachments. Although you could probably add attachments with some work, you don't have to because you have the Java Mail API is at your disposal.

The Java Mail API is a generic mail framework that supports the sending and retrieving of mail messages. The best part is, it supports multiple mail protocols through the same set of objects.

Sending Email with the Java Mail API

The Transport object represents a mail-delivery protocol like SMTP. You can use a Transport object to send Message objects. When you create ...

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