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:
- Install and use any SMTP server such as Postfix server, Apache James server etc.
- Use the SMTP server provided by the host provider.
- Use the SMTP Server provided by other companies e.g.yahoo, gmail etc.
Basic steps to send an email using JavaMail API:
- Get the Session object.
- Compose the message.
- Send the message.
JavaMail API sending email examples:
- Send simple email example.
- Send email with attachment example.
- Send HTML content in email example.
- Send inline image in email example.