Setup Ghost with Mailgun Api
This website uses a self-hosted Ghost instance. To let Ghost send emails, there are configurations to apply your MailGun settings. The documentation does not provide an example to use the MailGun api, only a MailGun SMTP configuration is shown.
As Ghost is OpenSource I started digging to see how this must be configured. Ghost uses their own NPM package for as a wrapper around nodemailer. NPMjs.org can show the source of this package. That showed that this package already uses the nodemailer-mailgun-tranport NPM package. This package supports both the SMTP and API MailGun options. When looking at the source I was able to see what configuration settings are needed.
To use the Mailgun API, use the following configuration in your config.production.json:
{
"mail": {
"from": "noreply@[your domain]",
"transport": "mailgun",
"options": {
"url": "https://api.eu.mailgun.net",
"auth": {
"domain": "[put your mailgun domain here]",
"apiKey": "[put your key here]"
}
}
}
}