Use your own email server with Ghost

Posted by Sven Kiljan on in Ghost

There are a lot of examples on the Internet for configuring Ghost's mail functionality. The examples I encountered assume that a service is used for which Ghost's NodeMailer contains built-in settings. Ghost's support page for configuring the internal email client only notes examples for Mailgun, Amazon's Simple Email Service and Google's Gmail.

Here I present templates for Ghost's configuration to use your own mail server.

config.js (Ghost 0.x):

        mail: {
          from: 'My Ghost Site Name <address@domain.ext>',
          transport: 'SMTP',
          options: {
            host: 'hostnameoripofmailserver',
            port: 465, // 25 or 587 for plain text/STARTTLS, 465 for SSL/TLS
            secureConnection: true, // true for SSL/TLS, false for everything else
            ignoreTLS: false, // set to true to force plain text when STARTTLS is supported
            auth: {
              user: 'usernameofmailaccount',
              pass: 'passwordofmailaccount'
            }
          }
        },

config.production.json (Ghost 1.x):

    "mail": {
        "from": "My Ghost Site Name <address@domain.ext>",
        "transport": "SMTP",
        "options": {
            "host": "hostnameoripofmailserver",
            "port": 465,
            "secureConnection": true,
            "ignoreTLS": false,
            "auth": {
                "user": "usernameofmailaccount",
                "pass": "passwordofmailaccount"
            }
        }
    },

For more configuration options, see the file node_modules/nodemailer/README.md of your Ghost installation. Look for the section titled 'Setting up SMTP'.

To test whether emailing works, visit the Labs page in Ghost's admin area and use the 'Send a test email' or 'Test email configuration' function.

Comments