Ghost Labs: Mailgun domain and API

Hello I am self hosting a ghost website.
I am experiencing some problems using Ghost Labs Newsletter feature.
When I set up my mailgun domain and API key the newsletter fails to send.

Here are the steps I took.

First: domain
domain: mail.libreadvice.org
API key: private API key
When I test the email from the post sidebar it says:
“Error sending mail, please check your Mailgun configuration”

Second: full api EU link
domain: https://api.eu.mailgun.net/v3/mail.libreadvice.org
or domain: https://api.eu.mailgun.net/v3/mail.libreadvice.org/messages
From the post sdebar for test email it says “Email Sent” but the email does not really send and it does not reach the mailgun server either.

I tried using mailgun from command line with curl and it works so I am pretty confident that the url, API key and DNS settings are correct.

Here are my ghost configurations.

  • Version 3.2.0
  • Environment production
  • Database mysql
  • Mail Direct

Please, can you help me? Thanks a lot

2 Likes

Same problem

This is what I am using in my config. See if it works for you (switching out your credentials). And change the HOST if you are not on EU

"mail": {
    "transport": "SMTP",
    "options": {
        "service": "Mailgun",
        "host": "smtp.eu.mailgun.org",
        "port": 465,
        "secureConnection": true,
        "auth": {
            "user": "USERHERE",
            "pass": "PASSHERE"
        }
    }
 
},

Also, REMEMBER TO RESTART Ghost for changes to take effect.

Having the same problem with the newsletter feature. As @inknos says, I’m advised the test email has been sent but no email arrives and it doesn’t reach Mailgun either.

I have configured my production configuration to send all emails via Mailgun. Subscription sign up emails are coming through correctly (the headers indicate the email comes from Mailgun too).

Ghost has been restarted, and I’m currently configured with the full API link (https://api.eu.mailgun.net/v3/blog.domain-redacted).

Any ideas please?

  • Ghost-CLI version: 1.13.1
  • Ghost version: 3.13.4
  • Node version: 12.16.2
  • Npm version: 6.14.4

Hello,

I have now tested Mailgun using the command line on my server:

curl -s --user 'api:redacted-aaaaaaaa-aaaaaaaa' https://api.eu.mailgun.net/v3/blog.example.org.uk/messages -F from='Blog <noreply@blog.example.org.uk>' -F to=me@example.org.uk -F subject='Testing from SSH' -F text='Testing mailgun from Blog server.'

The email is correctly delivered.

The problem only seems to be when sending emails via the members feature. Specifically the “Email Newsletter > send test email” function.

The Ghost log shows:

{“name”:“Log”,“hostname”:“blog-server”,“pid”:12337,“level”:30,“req”:{“meta”:{“requestId”:“a5651543-7627-44f7-88e9-09a341881798”,“userId”:“5”},“url”:“/email_preview/posts/redacted/”,“method”:“POST”,“originalUrl”:“/ghost/api/v3/admin/email_preview/posts/redacted/”,“params”:{“id”:“redacted”},“headers”:{“host”:“blog.example.org.uk”,“x-forwarded-proto”:“https”,“x-real-ip”:“redacted”,“x-forwarded-for”:“redacted, redacted”,“connection”:“close”,“content-length”:“38”,“accept-encoding”:“gzip”,“cf-ray”:“1354198b9ebc6a83-LHR”,“cf-visitor”:“{"scheme":"https"}”,“user-agent”:“Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0”,“accept”:“application/json, text/javascript, /; q=0.01”,“accept-language”:“en-GB”,“referer”:“https://blog.example.org.uk/ghost/",“content-type”:"application/json; charset=UTF-8”,“x-ghost-version”:“3.13”,“app-pragma”:“no-cache”,“x-requested-with”:“XMLHttpRequest”,“origin”:“https://blog.example.org.uk”,“dnt”:“1”,“cookie”:“REDACTED”,“cf-request-id”:“redacted”,“cf-connecting-ip”:“redacted”,“cdn-loop”:“cloudflare”},“query”:{}},“res”:{“_headers”:{“x-powered-by”:“Express”,“cache-control”:“no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0”,“access-control-allow-origin”:“https://blog.example.org.uk”,“vary”:“Origin, Accept-Encoding”,“content-type”:“application/json; charset=utf-8”,“content-length”:“2”,“etag”:“W/"2-vyHn7IuFo4RvsFtPoIWeCReyIC8"”},“statusCode”:200,“responseTime”:“218ms”},“msg”:“”,“time”:“2020-04-25T12:34:43.377Z”,“v”:0

Any assistance would be gratefully received.

Many thanks,

Jonathan