How To Configure Ghost To Send Email


How To Configure Ghost To Send Email

Ghost has a default ability to send email in some environments but it is recommended to do some extra configurations to setup an email delivery service. In this post we will discuss sendmail (the default built in option), Mailgun (the recommended 3rd party email service), and SendGrid.

sendmail

Without any changes to your config.js file Ghost will attempt to use the command line program, sendmail. If you can ssh into your hosting environment you can check if your environment includes sendmail by running:

which sendmail

This will return something similar to /usr/sbin/sendmail

Or it will return nothing indicating you do not have sendmail installed. Without specifically telling Ghost to use sendmail, it will display the following message: > Ghost is currently unable to send e-mail. See http://docs.ghost.org/mail for instructions

You can fix this error by adding the following to your config.js:

 mail: {
        transport: 'SMTP',
        options: {
        service: 'Sendmail',
        }
    },

You can find a sample config.js with sendmail installed here.

Mailgun

The first thing you need to do is signup for a free Mailgun accnout.

When signing up it is recommend to use your own domain name instead of a Mailgun generated one.

Once you have completed the signup and verified your email address, log into your Mailgun account. You need to verify ownership of your domain by adding some DNS records to you domain. Check out Mailguns documentation here for the setup. Once that is complete and you are back in the Mailgun Control Panel click on your domain name in the Custom Domains section.

mailgun - Custom Domains

On this page you will find the SMTP authentication information we need to provide Ghost.

mailgun - SMTP Authentication

With the information provided by Mailgun copy and paste the following section into to your config.js file replacing user and pass with your specific information:

mail: {
        transport: 'SMTP',
        options: {
            service: 'Mailgun',
            auth: {
                user: 'postmaster@yoururl.com',
                pass: 'password'
            }
        }
    },

You can view a sample config.js file with MailGun configured here.

You can test that your configuration is working by logging out of Ghost and going to example.com/ghost/forgotten/. After entering your email address Ghost will use Mailgun to send an email with a new password.

SendGrid

To get started with SendGrid signup for their free account here. Once you are signed up and have verified your account you can provide your SendGrid user account information to Ghost to send email. Copy and paste the following section into your config.js file replacing user and pass with your SendGrid account credentials. mail: {
transport: 'SMTP', options: { service: 'Sendgrid', auth: { user: 'username', pass: 'password' } } },

You can view a sample config.js file with SendGrid configured here.