Send email with Ghost using SMTP authentication and TLS encryption

Ghost Publishing platform uses Nodemailer to send e-mails with Node.js. It can send e-mail using SMTP, sendmail or Amazon SES and is unicode friendly.

As you know, more and more web hosting providers require SMTP authentication (often abbreviated as SMTP AUTH) and a TLS encrypted connection to send email. Here you’ll find some script examples to Send secure SMTP email from your website.

Can we do the same with Ghost and Node.js?

Yes we can! Nodemailer is a module for Node.js, perfect for sending out emails, with support included for Unicode, HTML, SMTP, XOAUTH, SSL and TLS. Nodemailer supports SMTP authentication and TLS encryption out-of-the-box, as we can find in the readme.md on Github. What do we need to configure?

There is one important configuration setting for Nodemailer:
secureConnection needs to be set to false, since the connection is started in insecure plain text mode and only later upgraded with STARTTLS. Given the configuration key name, you’d assume this would have to be set to true.

Configure Ghost to send authenticated SMTP over TLS #

To configure Ghost to send authenticated SMTP over a TLS encrypted connnection, open up your config.js file. Edit or add the mail config:

production: {
  // [...]
  mail: {
    transport: 'SMTP',
    options: {
      port: 25, // or 587
      host: 'smtp.example.com',
      secureConnection: false,
      auth: {
        user: 'user@example.com',
        pass: 'password'
      }
    }
  },
  // [...]
},

That’s it. Be sure to use your production environment.

I thought you might find this interesting:   How to fix a Joomla! HTTP 500 error after updates

Please Support Saotn.org

Each post on Sysadmins of the North takes a significant amount of time to research, write, and edit. Therefore, your donation helps a lot! For example, a donation of $3 U.S. buys me a cup of coffee, and as you know: things jsut work better with coffee. A $10 U.S. donation buys me one month of web hosting (yes, hosting costs money). But seriously, thank you for any amount. Much appreciated!

Please donate to support this site if you found a post interesting or if it helped you solve a problem. Thanks! (Tip: no Paypal account required)

If you appreciated this post, then please donate using this Paypal button


Jan Reilink

My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization.

Leave a Reply

1 Comment on "Send email with Ghost using SMTP authentication and TLS encryption"

Hi! Join the discussion, leave a reply!

Sort by:   newest | oldest | most voted
Cristian O. Balan (@oviliz)
Guest

Even that, Gmail says:
encryption: zoho.com didn’t encrypt this message