Sending Mail via GMail with JavaMail
If you use JavaMail and/or the Spring MailSender bean to send mail through a GMail account with JavaMail these days, you get an authentication error saying GMail blocks less secure apps. At that point there are two options: Configure your GMail account to accept low-security connections (e.g. https://www.google.com/settings/security/lesssecureapps) Configure your JavaMail sender to use OAuth for authentication This article will describe the second approach in detail. OAuth Basics Instead of usernames and passwords, OAuth deals with tokens. First, you set…