Mailgun & Fly.io – The 'What's New' page shows mail delivery as Direct despite entering Mailgun API key and domain

Why does my Ghost version widget show “Mail: Direct”? I mean the widget at the top left of the page at /ghost/#/whatsnew.

I’m self-hosting on Fly.io after following this tutorial. I’ve chosen to use the ghost:alpine Docker image, which gives me Ghost 4.47.4. I’ve signed up to Mailgun, verified my domain in the EU region, and have collected the API key by following the link in the admin section that accepts those details. I’ve filled out the form correctly as far as I know: the region is EU; the domain matches the name of the domain in the Mailgun admin; and the API key, I collected that from the link from the Ghost admin panel’s instructions.

I suspect I need to restart Ghost. Is this correct? I’ve tried running flyctl restart <app-name> to no avail. I suspect I should also be asking in the Fly.io forums, but I’m here first, and wondering if anyone else has the problem too.

I did a little reading around this forum, and I see a few solutions saying to restart Ghost when using the config file to set up Mailgun. Now that Mailgun integration is done through the web UI, does this still matter? I’ve tried restarting the app through flyctl, like I said.

As well as the What’s New page showing mail delivery as Direct (which I assumed to mean, not Mailgun, but Ghost’s internal delibvery mechanism), I can confirm that emails coming from a test signup to one of my own email addresses appear to be coming from somewhere that isn’t Mailgun, as I cannot find neither the mention of Mailgun nor my custom domain in the emails’ headers.

I hope the solution is simple.

There are two mail delivery setups:

  1. Transactional email - this is set via the config file and used for one-off emails like member signups, staff invites, etc
  2. Bulk email - only Mailgun is supported and is set through the UI, used for sending newsletters to members

You’ll need to configure both for a fully working setup.

1 Like

This is for transactional email, and this is handled by your server. On my site, I use Mailgun, so this says SMTP. You can change this in config.production.json.

1 Like

Thank you both for your insights.

I now take it that the “Mail: Direct” part of that widget is informing me of the status of transactional delivery. I’ll look into using the Mailgun SMTP (or preferably API; we’ll see) setup for transactionals, as that’ll help me stay out of spam folders if people sign up; and I’ll trust for now that the bulk will go through Mailgun, since I’ve done that part already.

May I suggest a feature of having two separate notices on the ‘What’s New’ page? Something like:

Transactional mail: Direct
Bulk mail: Mailgun

Anyways, thanks very much to both fo you for helping me understand where I’m at and what I need to try next.

1 Like

For transactional email, use Mailgun SMTP. For mailing lists, you use the API, and this is setup under Settings > Email newsletter.

I think I’ve got it right, but the widget is saying “Mail: Native” after I set the SMTP credentials. I set them through the Fly project’s fly.toml file after converting the JSON to TOML with a converter. Either 4.47.4 is calling SMTP ‘Native’ now or I’ve set up something entirely different.

Your changes weren’t successful if you still see “Direct”. I neither use Fly nor Docker with Ghost, but I would imagine you should edit config.production.json and then execute docker-compose up -d.

You need to add this with your credentials:

// config.production.json

"mail": {
  "transport": "SMTP",
  "options": {
    "service": "Mailgun",
    "auth": {
      "user": "postmaster@example.mailgun.org",
      "pass": "1234567890"
    }
  }
},