Mail config issue

Been discussing with Mailgun and it seems the issue isn’t there. Here’s what I’m getting, followed by what I’ve done so far:

Error with transactional email when trying to sign-up a test user to the newsletter:
POST https://wevchange.org/members/api/send-magic-link/
Response: 500 Internal Server Error
```
{
“errors”: [
{
“message”: “Failed to send email. Reason: Sending failed.”,
“context”: null,
“type”: “EmailError”,
“details”: null,
“property”: null,
“help”: “Please see Configuration - Ghost Developer Docs for instructions on configuring email.”,
“code”: null,
“id”: “b992da60-db6e-11f0-95e4-cf1f9b02b80c”,
“ghostErrorCode”: null
}
]
}
```

I got my API key from https://app.mailgun.com/settings/api_security, provided by both Ghost and Mailgun.

I assumed perhaps it was due to SMTP configuration (but I assume newsletter signup is through the API…maybe it was failing due to a transactional email not sending?) So gathered the SMTP config from Mailgun, made sure to use the subdomain, and added those to the config.local.json file for production.

I restarted, still same result. Anyone know what’s going on?

(Using Northflank for prod)

Ghost uses SMTP for transactional emails and the newsletters themselves go through the API in your settings. I suggest running ghost in a docker compose instance and including your SMTP credentials to the .env file. I suggest this as Ghost is moving in this direction as the official method of selfhosting. This will mitigate future migrations.

Could you please share your Ghost config.production.json, or the docker compose, redacting secrets? I suspect you’ve configured newsletters but not transactional email. You absolutely can send transactional email via Mailgun API (and it can be more reliable than using SMTP, which your host might block), but you do have to configure it.

If it could all be through the API that’d be great. Here’s the config redacted:

{

“url”:null,

“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”:“{REDACTED}”,

“port”:3306,

“user”:“{REDACTED}”,

“password”:“{REDACTED}”,

“database”:“{REDACTED}”,

“ssl”:{}

}

},

“mail”:{

“transport”:“SMTP”,

“options”:{

“host”:“smtp.mailgun.org”,

“port”:587,

“secure”:false,

“auth”:{

“user":"name@subdomain.ourdomain.org”,

“pass”:“{REDACTED}”

  }

},

“from”:“{SAME AS ABOVE}”

}

}

API-based example here: Make onboarding emails also work via API (not only SMTP)

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

I saw someone saying you have to use the mail send API, not the general API, but that didn’t work either

Which API key is this? Would the config override this or are both necessary?