O'Reilly logo

Java 9: Building Robust Modular Applications by Jason Lee, Peter Verhas, Dr. Edward Lavieri

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

JavaMail, the Standard Java API for Email

The JavaMail API is a set of abstractions that provide a protocol and platform-independent way of working with email. While it is a required part of Java Enterprise Edition (Java EE), it is an add-on library for Java SE, meaning you'll have to download it separately, which we'll handle via our POM file.

Our primary interest with this chapter's application is message management, but we'll take a bit of time to look at sending email using the API, so you'll have something to work with should you ever find yourself needing to do so.

To start sending mails, we need to get a JavaMail Session. To do that, we'll need to set up some properties as follows:

 Properties props = new Properties(); props.put("mail.smtps.host", ...

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