Gmail Email problem configuration

Hello, I have problem with mail configuration with ghost. I’m using docker image and configure the mail data with environment variables like this:

I used Gmail smtp for send mails in other systems with success, but without success on ghost :frowning:

This is my configuration:
- mail__transport=SMTP
- mail__options__host=smtp.gmail.com
- mail__options__port=587
- mail__options__auth__user=no-reply@gmailsubdomain.com
- mail__options__auth__password=password
- mail__from=no-reply@gmailsubdomain.com

Also I try with the secureConnection=true or false and with port 465 or 587. On all cases the error was:

Failed to send email. Reason: Invalid login - 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials e6sm1879051qkg.89 - gsmtp.

I use the above settings for gitlab on my own server and all works ok…
any help appreciated…

Same error for me (Failed to send email. Reason: Invalid login - 535 Authentication failed: Bad username / password.)
I’m using GHOST 2.37.0 On Azure App Service (Windows)
Config added to config.production.json
“mail”: {
“transport”: “SMTP”,
“from”: “‘my email’ av8or@email.com”,
“options”: {
“service”: “Gmail”,
“auth”: {
“user”: “av8or@gmail.com”,
“pass”: “P@ssowrd”
}
}
},
Set the gmail to “allow less secure”

perhaps the password is spelled wrong - owrd?

No, the password is ok. Also I tried to use the configuration with another software with smtp and It works ok, so the problem is with ghost or ghost in docker…

Any news on this one? I am also stuck here…

Is it a personal email account? If so, try changing to:

mail__options__auth__pass=password

I also had to generate a password for apps in Google. See here.

Working fine for me. Hope this helps.

I had some fun with this a while ago. I managed to get it working in the end with a custom domain in GSuite, not a Gmail account. But it should be very similar.

The config in your config.*.json file should look something like this.

"mail": {
    "from": "from_email_address",
    "transport": "SMTP",
    "options": {
        "service": "gmail",
        "host": "smtp.gmail.com",
        "port": 465,
        "auth": {
            "user": "email_address",
            "pass": "app_password"
        }
    }
},

In your Gmail or GSuite account, log into the account, go to My Account, Security, App Passwords. Create an app password (bypasses 2 Step Verification if it is setup) then try sending an email from Ghost.

Please note: When you send an email for the first time it may be blocked. Check for a blocked email in your Google account to “approve” Ghost sending the email. You should then be free to send any emails once you have approved it.