Make onboarding emails also work via API (not only SMTP)

I notice you’re using a sandbox domain. MG doesn’t allow delivery to anywhere except the addresses registered with it if you’re using the sandbox. If you’ve got a mismatch between the addresses MG thinks are OK for the sandbox and the address you’re trying to sign up, that’s a problem.

You probably want to switch from the sandbox to a real domain, asap.

Got it, I will look into that. Thank you for your time!

Edit: The issue was the sandbox domain as you mentioned. I configured my domain in Cloudflare with the settings Mailgun suggested.

And the .env file for Docker looks like this:

mail__transport=mailgun
mail__host=api.mailgun.net
mail__from=bXXXXX@gmail.com
mail__options__auth__api_key=9e60dxxxxxxxxxxxxxxxxxxxxxxxxx-1xxxxx0-f4xxxxx2a
mail__options__auth__domain=mail.myowndomain.com

Seems to work. Thanks, maybe it can help someone else.

Thanks, @bjokib — this worked perfectly for me!

For anyone else going down this road, one thing to add is that I needed to create a Mailgun API “sending key,” which is different from a regular ol’ API key. You can find it in the Mailgun sidebar in Send → Sending → Domain Settings → Sending Keys

Cheers!

I tried this, including using the Sending Key rather than the general API key, but neither work for me

getting “Unknown Content API Key” from /settings, /tiers, and /newsletters after /member now 204s successfully

Screenshot 2025-12-18 at 11.47.43 AM

Screenshot 2025-12-18 at 11.47.43 AM676×395 46.3 KB

Here’s my config:

{

  "url":"https://mydomain.org",

"server":{

"port":2368,

"host":"0.0.0.0"

  },

"security":{

"staffDeviceVerification":false

  },

"logging":{

"transports":["file","stdout"]

  },

"process":"systemd",

"paths":{

"contentPath":"/var/lib/ghost/content"

  },

"database":{

"client":"mysql2",

"connection":{

"host":"path.to.mysql.db.in.northflank",

"port":3306,

"user":"5cxxxxxxxxxxxx86",

"password":"a3xxxxxxxxxxxxxxxxx9",

"database":"fxxxxxxxxxxxxxxxxxxxxd",

"ssl":{

"rejectUnauthorized": false

      }

    }

  },

"mail":{

"transport":"mailgun",

"from":"hello@mg.mydomain.org",

"options":{

"host":"api.mailgun.net",

"auth":{

"api_key":"79xxxxxxxxxxxxxxxxxxxxxxxxxad-96xxxx60-8xxxxxx3",

"domain":"mg.mydomain.org"

      }

    }

  }

}