Email was the Internet’s first killer app. One of the most frequently asked questions
about Java is how to send email from a Java applet or application. While it’s certainly
possible to write a Java program that uses sockets to communicate with mail servers,
this requires detailed knowledge of some fairly complicated protocols, such as SMTP,
POP, and IMAP. Just as the URL class makes interacting with HTTP servers a lot simpler
than it would be with raw sockets, so too can a class library dedicated to handling email
make writing email clients a lot simpler.
The JavaMail API is a standard extension to Java that provides a class library for email
clients. It’s a required component of the Java Platform, Enterprise Edition. The JavaMail
API can be implemented in pure Java using sockets and streams, and indeed Oracle’s
reference implementation is so implemented. Programs use the JavaMail API to communicate
with SMTP, POP, and IMAP servers to send and receive email. By taking
advantage of this API, you can avoid focusing on the low-level protocol details and focus
instead on what you want to say with the message. Custom providers can support the
proprietary features of mail systems such as Gmail and Microsoft Exchange. You can
even install providers that add support for NNTP, the protocol used to transport Usenet
news.
Send and receive email from Java applications by using the JavaMail API. With this concise book, you’ll learn how to communicate with existing SMTP, POP, and IMAP servers, and how to write your own.
Whether you need to build an email-centric application like a mailing list manager or simply add email notification to a larger product, JavaMail is the answer. Packed with code examples, this book shows you how JavaMail enables you to avoid low-level protocol details, so you can focus on what you actually want to say in a message.
-
Send, receive, and store email with POP3 and IMAP
-
Add password authentication to your programs
-
Manage mailboxes and accounts
-
Download mail attachments
-
Respond to asynchronous email events
-
Design protocol-independent email programs