- JavaMail API Tutorial
- JavaMail - Home
- JavaMail API - Overview
- JavaMail - Environment Setup
- JavaMail - Core Classes
- JavaMail - Sending Emails
- JavaMail - Checking Emails
- JavaMail - Fetching Emails
- JavaMail - Authentication
- JavaMail - Replying Emails
- JavaMail - Forwarding Emails
- JavaMail - Deleting Emails
- JavaMail - Gmail SMTP server
- JavaMail - Folder Management
- JavaMail - Quota Management
- JavaMail - Bounced Messages
- JavaMail API Protocols
- JavaMail - SMTP Servers
- JavaMail - IMAP Servers
- JavaMail - POP3 Servers
- JavaMail API Useful Resources
- JavaMail - Quick Guide
- JavaMail - Useful Resources
- JavaMail - Discussion
JavaMail API - Environment Setup
To send an e-mail using your Java Application is simple enough but to start with you should have JavaMail API and Java Activation Framework (JAF) installed on your machine.
You will need the JavaBeans Activation Framework (JAF) extension that provides the javax.activation package only when you're not using Java SE 6 or newer.
You can download latest version of JavaMail (Version 1.5.0) from Java's standard website.
You can download latest version of JAF (Version 1.1.1) from Java's standard website.
Download and unzip these files, in the newly created top level directories you will find a number of jar files for both the applications. You need to add mail.jar and activation.jar files in your CLASSPATH.
SMTP server
To send emails, you must have SMTP server that is responsible to send mails. You can use one of the following techniques to get the SMTP server:
Install and use any SMTP server such as Postfix server (for Ubuntu), Apache James server (Java Apache Mail Enterprise Server)etc. (or)
Use the SMTP server provided by the host provider for eg: free SMTP provide by JangoSMTP site is relay.jangosmtp.net (or)
Use the SMTP Server provided by companies e.g. gmail, yahoo, etc.
The examples in the subsequent chapters, we've used the free JangoSMTP server to send email. You can create an account by visiting this site and configure your email adress.