TypeError: Cannot create property 'mailer' on string 'smtp'

Unable to setup a mail configuration with google on Ghost v3.8.
Please find the mail properties on config.production.json
“mail”: {
“service”: “Gmail”,
“transport”: “SMTP”,
“options”: {
“host”: “smtp.gmail.com”,
“port”: 465,
“secureConnection”: true,
“auth”: {
“user”: “@gmail.com",
“password”: "
******”
}
}
},
This is the error i’am getting when trying to restart ghost with above configuration.

Did you tried with less secure password on gmail account setting?
& also use downcase

“service”: “gmail”,

@inoryum
I tried both less secure password on gmail, lowercase as “gmail”. But of no luck.
my config.production.json path is: /var/www/ghost/core/server/config/env

Can you check the user has correct permission?
check if the folder have 775 permission
EG

sudo chmod 775 /var/www/ghost

& your current user is the owner of the folder

for Example

sudo chown $USER:$USER /var/www/ghost

@inoryum I did gave it a try, no luck .

Oke last thing can you check on your server if the quotes are this" " instead of“ ”?

Can can you send me a screenshot of your config.json file hiding your password & email?

@inoryum Please find the screenshot of config.production.json

image

Use the following config i trimed some of config & let me know. I have checked the following in my server working good… Make sure u turned off less secure app from your gmail account

"mail": {
    "from": "yourfromname<email@gmail>",
    "transport": "SMTP",
    "options": {
        "host": "smtp.gmail.com",
        "port": 587,
        "auth": {
            "user": "user@gmail.com",
            "pass": "password"
        }
    }
},

Replaced the config of yours, it’s the same error again.
"Cannot create property ‘mailer’ on string ‘SMTP’ "

Okay seems its not a config issue… but i am suspecting the issue with the nodemailer… may be we should wait for some experts to answer on this.
@John @fabien

@inoryum Just FYI, the current versions that I have are
“nodemailer”: “^6.4.2”,
“nodemailer-smtp-transport”: “^2.7.4”,

The nodemailer version used by Ghost is 0.7.1 https://github.com/TryGhost/Ghost/blob/master/package.json#L120

Did you change this manually @workman?

1 Like

Nope by default, I have this nodemailer 6.4.2 installed.

Okay, well by default the nodemailer version is 0.7.1 :thinking:

How did you install Ghost?

I would try removing your node_modules directory and running yarn to reinstall the correct versions of dependencies

2 Likes

Installing the nodemailer version 0.7.1 worked for me.
Thanks for all your time and help @fabien @inoryum.

1 Like