Why Spring mail does not recognize my Gmail account?

Viewed 212

In my SpringBoot application i'm using Spring mail to send emails from a Gmail account (i connected through an app password). It was working fine, but after a time (about a week), it stopped working and i got an error telling me thanks username and password didn't match. After i connected to my Gmail account to check if the app password is still active, it started working again.

After another week, it happened again.

My question is : is there any validity time for the application password ? Can i increase it ? Why is it doing this ? How can i solve this ?

The error : 534 5.7.9 https://support.google.com/mail/?p=WebLoginRequired k18sm5238866wms.1 - gsmtp ] with root cause ...

application.properties :

spring.mail.host=smtp.gmail.com

spring.mail.port=587

spring.mail.username= my email

spring.mail.password= the app password

spring.mail.properties.mail.smtp.auth=true

spring.mail.properties.mail.smtp.starttls.enable=true

Thank you for your help

0 Answers
Related