Ghost Integration with Mailgun

Hello I am new to ghost technology i am having trouble in setting up mail for my ghost theme i am using ghost version 2.29.1 and using chrome browser this is the configuration setup for mail in config.development.json but every time when i send a test mail from my ghost setting - labs it giver me error of Failed to send email. Reason: connect ECONNREFUSED 54.149.106.135:587.
Any help will be valuable. Thanks in advance

file28%20PM

Try simplifying your settings down to the bare minimum:

"mail": {
        "transport": "SMTP",
        "options": {
            "service": "Mailgun",
            "auth": {
                "user": "your user",
                "pass": "your pass"
            }
        }
    },

Remember to run ghost restart after changing config.

If you’re still getting errors, take a look in ghost log to see if you can get more details about the error.

1 Like

Still getting Error below is the log after bare minimum setting.

`[2019-09-03 19:23:21] ERROR “POST /ghost/api/canary/admin/mail/test/” 500 328ms

NAME: EmailError
CODE: ECONNREFUSED
MESSAGE: Failed to send email. Reason: connect ECONNREFUSED 54.149.106.135:587.

level: normal

“Please see Configuration - Adapt your publication to suit your needs for instructions on configuring email.”
EmailError: Failed to send email. Reason: connect ECONNREFUSED 54.149.106.135:587.
at EmailError.GhostError (/Users/clines192/Documents/Zia/ghost-App/iSystematic/versions/2.29.1/core/server/lib/common/errors.js:10:26)
at new EmailError (/Users/clines192/Documents/Zia/ghost-App/iSystematic/versions/2.29.1/core/server/lib/common/errors.js:34:20)
at MailComposer.returnCallback (/Users/clines192/Documents/Zia/ghost-App/iSystematic/versions/2.29.1/core/server/services/mail/GhostMailer.js:77:31)
at SMTPConnectionPool._onConnectionError (/Users/clines192/Documents/Zia/ghost-App/iSystematic/versions/2.29.1/node_modules/simplesmtp/lib/pool.js:334:17)
at SMTPClient.emit (events.js:198:13)
at SMTPClient.EventEmitter.emit (domain.js:448:20)
at SMTPClient._onError (/Users/clines192/Documents/Zia/ghost-App/iSystematic/versions/2.29.1/node_modules/simplesmtp/lib/client.js:373:10)
at Socket.emit (events.js:198:13)
at Socket.EventEmitter.emit (domain.js:448:20)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

Error: connect ECONNREFUSED 54.149.106.135:587
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)`

Thanks for Response, i use the same mailgun account but with api select instead of SMTP for my nodejs program for testing and it works, is there any way to use api method in ghost app ?

No, there’s no way to do that.

It seems like either your mailgun account isn’t configured to accept the traffic - or you’ve got some sort of firewall preventing the connection.

Thanks, it might be due to domain of mail gun i am using mailgun provided domain for testing purpose.