Issues using gmail's smtp server: Google reduced access to third party apps


I’m trying to set up a new indico server on Amazon LightSail and using a gmail account as the smtp server.

The SMTP section of my indico.conf looks like this:
SMTP_SERVER = (‘smtp. gmail. com’, 587)
SMTP_LOGIN = ‘ @gmail. com’
SUPPORT_EMAIL = ‘ @gmail. com’
PUBLIC_SUPPORT_EMAIL = ‘ @gmail. com’

In the logs, I am getting error messages like this:
2023-05-01 03:57:02,881 WARNING 0000000000000000 - indico.emails Could
not send email “[Indico] Verify your email” (attempt 5/10); retry in 600s [(535, b’5.7.8 U
sername and Password not accepted. Learn more at\n5.7.8 https :// support. google. com/mail/?p
=BadCredentials d24-20020a170902b71800b001aaffe15f39sm96394pls.30 - gsmtp’)]

[I had to put spaces in the link above because the forum wouldn’t let me post a notice with more than 2 links.]

It seems that it is related to this May 30, 2022 announcement from Google disabling access for “Less Secure Clients”. Less secure apps & your Google Account - Google Account Help

Has anyone faced this issue before? Any help would be much appreciated.

This was solved by activating two factor authentication and then using App Passwords as described here: Sign in with App Passwords - Google Account Help