Sending Email in Java through Gmail Server
We can send email by using the SMTP server of gmail. It is good if you are don't have any SMTP server and reliable. Here we will learn how to send email through gmail server by SSL (Secured Socket Layer). SSL is basically used for security if you are sending email through gmail server.
Disable the antivirus e.g. avast etc. because it may interrupt your code to send emails.
Example of Sending Email through Gmail Server with SSL
As you can see in the above example, userid and password need to be authenticated. As, this program illustrates, you can send email easily but change the username and password accordingly. Let's see how to run it once again by simple technique:
Click on this link and click on turn on radio button to allow users to send mail from unknown location. https://www.google.com/settings/security/lesssecureapps