Configure custom SMTP with Ghost

Configure custom SMTP with Ghost

Ghost is a very powerful publishing platform written in NodeJS. This site runs on ghost and we're very confident of the platform. One particular challenge we faced was to get the emails working. Ghost provides documentation for Mailgun and AWS SES but no information is provided for using custom SMTP (e.g. self hosted systems like mailcow or mailinabox). We at tekduke have our own SMTP and wanted to use it for the website as well. This process involves editing the config.production.json file in the document root of ghost (e.g. /var/www/ghost).

Under the file, You'll find a section titled mail which should looks somewhat like:

  "mail": {
    "transport": "direct",
  },
config.production.json

The above section needs to be replaced as follows:

  "mail": {
    "from": "'Example Sender Name' <[email protected]>",
    "transport": "SMTP",
    "options": {
      "host": "smtp.example.com",
      "port": 587,
      "auth": {
        "user": "[email protected]",
        "pass": "<[email protected]$$w0RD>"
      }
    }
  },
config.production.json

The from part is used to configure the sender name and email address.
transport is defined as SMTP so that ghost knows emails are routed through SMTP. host is Your mailserver's address. port can be any of 25, 465, 587 or any other port that Your SMTP server listens on.

If you found this tutorial useful, share it with others.

Bhanu Sharma

Bhanu Sharma

I don't know what I'm doing!
New Delhi, India