Sunday, August 23, 2015

org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException

When you try to send an email with Gmail SMTP,

you might get the following exception:

org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuBm
534-5.7.14 7mH3ysGBLpLeQAGDrZrkNi3uUJsTPF6P8pszrRFOKqdKWGKsDpWBkcrvwJC02xOAQsW7b-
...
534-5.7.14 zFvhhWx1SQ-yRuGO0fa8JMMszw3E> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14  Learn more at
534 5.7.14  https://support.google.com/mail/answer/78754 z16sm15149096pbt.3 - gsmtp

at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:424)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)

Go to the following URL:

https://www.google.com/settings/security/lesssecureapps

Set `Access for less secure apps` to `Turn on`.

Reference:
http://stackoverflow.com/questions/20337040/gmail-smtp-debug-error-please-log-in-via-your-web-browser

No comments:

Post a Comment