As we discussed in earlier tutorials that SMTP server is responsible for sending emails so we need SMTP server to send email from our java application.
We can get the SMTP server by using any one of the following techniques:
- 1. Install and use any SMTP server such as Postfix server, Apache James server etc.
- 2. Use the SMTP server provided by the host provider.
- 3. Use the SMTP Server provided by other companies e.g.yahoo, gmail etc.
Basic steps to send an email using JavaMail API:
- 1. Get the Session object.
- 2. Compose the message.
- 3. Send the message.
JavaMail API sending email examples:
- 1. Send simple email example.
- 2. Send email with attachment example.
- 3. Send HTML content in email example.
- 4. Send inline image in email example.