Can't setup Gmail as a SMTP server on Keycloak

I am trying to set up Gmail as an SMTP server for enabling forgot password.

The password that I am using is the app password generated from Gmail

And I am getting this error-

ERROR [org.keycloak.services.resources.admin.RealmAdminResource] (executor-thread-0) Failed to send email
javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset

Any success with this one?

After lot of search for this, I found nothing. So I just tried Microsoft 365 smtp server and it is working like charm. I was looking for some SMTP server for fogot password thing, so I get it done by it

Can you still use your Microsoft 365 account? Mine doesn’t work cause they are forcing us to use 2FA - but app-password isn’t working.