简体   繁体   中英

Send email with Spring Boot app in Heroku

I've successfully deployed a Spring Boot app on Heroku. This app should send emails after an user fills a form.

The problem is that, in local it works, but in Heroku the app always throws AuthenticationFailedException because it is trying to sign in with my Gmail account from Heroku's server in another country.

My Gmail account does not have two factor authentication and less secure app option is enabled.

How can I solve this? How can my Spring Boot app in a server abroad sign in with my Gmail account from another country?

How can I solve this?

By not using Gmail. It's not meant for automated, programmatic email delivery.

Instead, use something like SendGrid or Mailgun . These services are designed for programmatic mail delivery, and both are available as official Heroku addons with free tiers .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM