If you are trying to configure SMTP mailing service using gmail.smtp and you are getting following errors "Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1"
--OR--
ERROR 20952 --- [ task-1] .a.i.SimpleAsyncUncaughtExceptionHandler : Unexpected exception occurred invoking async method: public void jorvee.service.EmailService.sendEmail(org.springframework.mail.SimpleMailMessage)
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 200sm76430073pfz.121 - gsmtp
--OR--
ERROR 18335 --- [ task-2] .a.i.SimpleAsyncUncaughtExceptionHandler : Unexpected exception occurred invoking async method: public void jobtrees.service.EmailService.sendEmail(org.springframework.mail.SimpleMailMessage)
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt
534-5.7.14 Learn more at
534-5.7.14 iC05HX07ZqNpOxwZG97A23wm3QihO6_1fPH781vcxEhWSCrdIXgikYN2holt0u2YZ2l2x
534-5.7.14 cX53zAOHNGSHJJAD7TrXgKGpWv_tg8wup1K7B79BdL0ZrQNJLj7SjTi-qZiwLQur>
534-5.7.14 Please log in via your web browser and then try again.
534 5.7.14 https://support.google.com/mail/answer/78754 m20sm22192035qkk.15 - gsmtp
although, your configuration are valid and correct, then, because of following reason you are facing this issue.
Your account is secured, and doesn't allow less secure applications to access.
By default Less secure app access is disabled in the google account. If you will enable this then it will fix your problem.
To enable the less secure app access in your google account, follow the below steps.
Step 1: Login to your google account.
Step 4: Click on the turn it back on, this will redirect you to a new page.
|
Less secure apps & your Google Account |
Step 5: See Allow less secure apps: status and; if this is OFF then ON it.