Send Email Using Java

In this tutorial, I am showing how to send an email using JavaMail Api. Sending email is a required use case for every project.
Here I am using gmail host( smtp.gmail.com) and gmail username and password for authentication. For a bigger projects, you have to use paid mail service provider and they will provide the required information like host and port parameters.
Here I am explaining following topics with complete examples
a) Sending plain text Email with JavaMail API
b) Sending HTML email with JavaMail API
c) Sending email attachment with JavaMail API