getting javax.mail.AuthenticationFailedException on heroku

255 Views Asked by At

I am Using Heroku to deploy my java spring boot backend which utilizes the javamailsender. When testing locally before deployment, I was able to send emails and receive emails thru the application. But, ever since I deployed it on heroku, I have been receiving error whenever I try to send email.

Error Sending Email: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.9 Application-specific password required. Learn more at
2020-07-17T01:00:29.110458+00:00 app[web.1]: 534 5.7.9  https://support.google.com/mail/?p=InvalidSecondFactor r188sm8440648qkf.128 - gsmtp
2020-07-17T01:00:29.110462+00:00 app[web.1]: 

I have seen plenty of articles/discussion forum where users encounter such problem and I tried to resolve using the solution that was given but was unsuccessful. I have the 2-Step-Verification on and turned on the less secure app but no luck. I also saw that doing App Password helped solved the issue but didn't really understand how to go about that in terms of my app on heroku. I have react frontend hosted on firebase and spring boot backend hosted on heroku. Any help would be appreciated. Thank you!

1

There are 1 best solutions below

0
On

Nvm, I figured out what was causing this error. I guess I had to create an App Password and use that password that was created inside my application.properties.