Home | WebServices | Maven | SOA | REST | Agile & SCRUM | Java & JEE
Homepage

Send email using Gmail and Java Mail API

This tutorial explains how to send email using gmail and java mail API and also mentions the necessary jar files that are required.

Step 1: Please download Java Mail and ensure activation.jar, mailapi.jar and smtp.jar are in the classpath.

Step 2: TheaMailConfig.java contains the configurations needed as shown in the below screen shot.
configclass (13K)

Step 3: TheaMail.java just contains getters and setters needed for representing email parameters as in the screen shot below.
mailvo (8K)

Step 4: TheaMailer.java creates a Session and send mail. The source code is as in the screen shot below.
Mailer (14K)

Step 5: Test.java invokes the code to send email as in the screen shot below.
invoker (6K)

 

 

Copyrights 2008 Thea Solutions
All rights reserved
Powered by 4creativeweb Solutions