Tuesday, April 14, 2015

Java: Send email through Gmail's SMTP server

There are various examples of using the JavaMail API for sending emails, e.g.
I was able to get my program up and running relatively quick. However, the code stopped working once I deployed it to my AWS EC2 instance. It threw an javax.mail.AuthenticationFailedException, and links to https://support.google.com/mail/bin/answer.py?answer=78754

Following the link above, I was able to resolve the issue by enabling allow less secure apps and allow access from a new location or device.

No comments: