Java Reference
In-Depth Information
http://www.oracle.com/technetwork/java/javamail/ .
Once you download it, unzip it and add the JavaMail .jar files as dependencies
from your project (both mail.jar and lib\*.jar ).
How It Works
The JavaMail API is included in the Java EE SDK, but if you are working with the
Java SE SDK, you will need to download and add the JavaMail API to your Java SE
project. By downloading and adding the dependencies, you get access to the robust e-
mail API that allows you to send and receive e-mails.
Note If you are not using Java SE 6 or newer, you will also need the JavaBeans
Activation Framework (JAF) to use JavaMail. It is included in Java SE 6 and newer.
19-2. Sending an E-mail
Problem
You need your application to send an e-mail.
Solution
Using the Transport() methods, you can send an e-mail to specific recipients. In
this solution, an e-mail message is constructed and sent through the
smtp.somewhere.com server:
private void start() {
Properties properties = new Properties();
properties.put("mail.smtp.host",
"smtp.somewhere.com");
properties.put("mail.smtp.auth", "true");
Session session
Search WWH ::




Custom Search