Server error when trying to test send mail


#1

- What version of Ghost are you using?
1.22.2

- What configuration?
Configuring using environmental variables rather than config.js as this is a docker container.
mail__transport=SMTP
mail__from="'Postmaster' <postmaster@mg.domain.tld>"
mail__options__service=Mailgun
mail__options__auth=postmaster@mg.domain.tld
mail__options__pass=[password]

- What steps could someone else take to reproduce the issue you’re having?
Ghost Admin > Labs > Test email configuration > Send

- What errors or information do you see in the console?

ERROR [2018-04-15 17:51:22] "POST /ghost/api/v0.1/mail/test/" 500 234ms
NAME: InternalServerError
MESSAGE: Cannot create property 'user' on string 'postmaster@mg.domain.tld'
level:normal
InternalServerError: Cannot create property 'user' on string 'postmaster@mg.domain.tld'
TypeError: Cannot create property 'user' on string 'postmaster@mg.domain.tld'
at SMTPTransport.initOptions (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/engines/smtp.js:78:32)
at new SMTPTransport (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/engines/smtp.js:52:10)


#2

Obvious but potentially dumb questions

your domain is approved/validated by MG, correct?
And you use the user/pw from MG?
And the MX record is configured in DNS?


#3

Yes, MX records have been set on my DNS and verified by Mailgun. I am also using the correct user and pass from mailgun.

It looks to be an application issue not accepting the email as the correct data type? I’d also tried wrapping the email in quotes like this:
mail__options__auth="postmaster@mg.domain.tld"

Here’s the full error stack:

ERROR [2018-04-15 23:37:15] "POST /ghost/api/v0.1/mail/test/" 500 245ms
`NAME: InternalServerError` `MESSAGE: Cannot create property 'user' on string 'postmaster@mg.domain.tld'`
level:normal
`InternalServerError: Cannot create property 'user' on string 'postmaster@mg.domain.tld'` ` at new GhostError (/var/lib/ghost/versions/1.22.2/core/server/lib/common/errors.js:9:26)` ` at prepareError (/var/lib/ghost/versions/1.22.2/core/server/web/middleware/error-handler.js:39:19)` ` at Layer.handle_error (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/layer.js:71:5)` ` at trim_prefix (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:315:13)` ` at /var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:284:7` ` at Function.process_params (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:335:12)` ` at next (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:275:10)` ` at Layer.handle_error (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/layer.js:67:12)` ` at trim_prefix (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:315:13)` ` at /var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:284:7` ` at Function.process_params (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:335:12)` ` at next (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:275:10)` ` at /var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:635:15` ` at next (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/index.js:260:14)` ` at next (/var/lib/ghost/versions/1.22.2/node_modules/express/lib/router/route.js:127:14)` ` at onAPIError (/var/lib/ghost/versions/1.22.2/core/server/api/index.js:290:13)`
TypeError: Cannot create property 'user' on string 'postmaster@mg.domain.tld'
at SMTPTransport.initOptions (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/engines/smtp.js:78:32)
at new SMTPTransport (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/engines/smtp.js:52:10)
at new Transport (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/transport.js:56:26)
at Object.module.exports.createTransport (/var/lib/ghost/versions/1.22.2/node_modules/nodemailer/lib/nodemailer.js:25:21)
at new GhostMailer (/var/lib/ghost/versions/1.22.2/core/server/services/mail/GhostMailer.js:17:33)
at sendMail (/var/lib/ghost/versions/1.22.2/core/server/api/mail.js:20:18)
at send (/var/lib/ghost/versions/1.22.2/core/server/api/mail.js:140:20)
at runTask (/var/lib/ghost/versions/1.22.2/core/server/lib/promise/pipeline.js:16:24)
at /var/lib/ghost/versions/1.22.2/core/server/lib/promise/pipeline.js:26:20
at tryCatcher (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/reduce.js:157:18)
at Object.gotAccum (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/reduce.js:144:25)
at Object.tryCatcher (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/var/lib/ghost/versions/1.22.2/node_modules/bluebird/js/release/async.js:17:14)


#4

Never mind, configuration issue. Tired eyes :upside_down_face:

mail__options__auth__user=postmaster@mg.domain.tld
mail__options__auth__pass=[password]

are the correct environmental variables to pass to ghost


#5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.