1. Validating DNS records

First of all, you need to add a new domain on your Mailgun dashboard. Mailgun recommends using a subdomain. For example, mg.yourdomain.com

2. Validating DNS records

After adding a domain, you need to enter required DNS records on your DNS provider dashboard. You can see the required record list in Sending > Domain settings > DNS records on your Mailgun dashboard. After adding them, click Check DNS Records Now button to validate them. If the records have a green checkmark on them, you're good to go.

Showing sending records as an example. There are more records on the dashboard.

3. Adding SMTP credentials

Now open config.production.json from your Ghost instance root directory and add your SMTP credentials. You can see the credentials in Sending > Domain settings > SMTP credentials on your Mailgun dashboard.

{
  ...,

  "mail": {
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "auth": {
        "user": "postmaster@mg.yourdomain.com",
        "pass": "PASSWORD"
      }
    }
  },

  ...
}

You can test the configuration in Settings > Labs > Test email configuration to see if it's working.

Please note that this is only used for transactional emails like inviting people to your blog and sending authentication links for members. If you need to send a newsletter, read the following instruction.

4. Sending newsletters

You can find the settings in Settings > Labs > Email settings. If you don't find them, make sure the membership feature is enabled.

Add your Mailgun region, domain (mg.yourdomain.com) and API key. The API key can be found in Settings > API Keys > Private API key on your Mailgun dashboard.

You can test the configuration in Post settings > Email newsletter section.