[Ghost] Install postfix and let Ghost send mails

Let's say you have a dedicated server running you blog on Ghost. Now every time you go to the /admin page, you get the following warning:

Ghost is currently unable to send e-mail.

Here is a guide to get you out of this bad situation in 10 minutes.

This has been tested with Ubuntu Server 12.04

Install Postfix

All we need now is to install a SMTP server so your server can send mails.

apt-get install postfix

Then select the following options:

  1. General type of mail configuration: Internet Site
  2. System mail name: example.com

Configure postfix

Now edit the configuration:

nano /etc/postfix/main.cf

And simply change the two following lines:

myhostname = example.com
mydestination = example.com, localhost

You can also check that only localhost is able to use the postfix server:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Exit nano and save, then

 service postfix reload

Test postfix

To test postfix installation, you can simply send a mail from command line:

 sendmail youraddress@somewhere.com
 Hi it works !
 Ctrl-D

After a few seconds, you should receive a mail in your mail box.
If not, you should check in your "SPAM" folder.
If still nothing you should check log files:

tail /var/log/mail.log
tail /var/log/mail.err

Edit Ghost configuration

nano /var/www/ghost/config.js

Add the following in the production part

production: {
    //...
    mail: {
        transport: 'sendmail',
        fromaddress: 'no-reply@example.com',
        options: {}
    },

Restart ghost service.

service ghost restart

That's all

References