Using “Free” Mailgun with self-hosted Ghost
Just a couple of notes about setting up a Mailgun pay-as-you-go account to use with a self-hosted Ghost setup for things I ran into that weren’t obvious to me.
Make sure to sign up for the Foundation trial for Mailgun
This lets you add a a credit card for billing and set up your own domain for sending emails. The trial is 30 days and you’ll downgrade it later.
There is an option to not add a credit card at sign-up time. This only allows using a “sandbox domain” which is for testing only and only allows 5 recipients that you have to add manually.
There is no way to add a credit card to turn this into their pay-as-you-go plan. The only way is to upgrade to the Foundation plan which won’t have a 30-day trial at that point and you’ll pay a pro-rated amount.
Create your own domain
As noted above for Mailgun to work with Ghost seamlessly you’ll need to add your own domain to the Foundation trial. Once you set this up you can send as many emails you want to as many people as you want. There may be some initial limitations while things ramp up as bulk email services like Mailgun need to make sure they’re not sending out spam emails which has a negative effect on their reputation with email providers.
Transactional vs bulk emails
Transactional emails are things like the verification links that get sent out when someone signs up for your newsletter and bulk email would be the actual newsletters themselves. These are handled a bit differently in the Ghost configuration.
Bulk email settings are best set up using the Ghost admin page in the settings section under “Mailgun settings”. Once you’ve configured your domain in Mailgun you would use the domain you set up there as well as create an API key and these values are plugged into the Mailgun settings section.
Transactional email setup depends on how you’re hosting Ghost but it can either be configured via the config json file or environment variables. See here in the Ghost docs and here for an actual Mailgun example (thanks Robert!).