Setup SMTP with Gmail

Hi all,

I’m trying to setup alerting by having Grafana send emails through the Gmail SMTP.
I run Grafana in docker so I setup SMTP using in a dockerfile:

  - GF_SMTP_ENABLED=true
  - GF_SMTP_HOST=smtp.gmail.com:587
  - GF_SMTP_USER=My_account@gmail.com
  - GF_SMTP_PASSWORD="""My_Password"""
  - GF_SMTP_SKIP_VERIFY=false
  - GF_SMTP_FROM_NAME=grafana
  - GF_SMTP_FROM_ADDRESS=My_account@gmail.com

I’m getting the following error:
535 5.7.8 Username and Password not accepted

I have tried many solutions found in these forums but none seems to work.
I know Gmail use to have a setting " Less secure app access" but you can’t use it anymore.
Is it still viable to use Gmail in Grafana without this setting?
If it is, how?

I believe you now have to use what Google calls “App Passwords”. And to use them you need to enable 2-factor authentication on your Google account. See here:

1 Like

This is correct.
It works now.
Thanks.