Cannot send SMTP emails after upgrading to Ghost 0.5.10

Ghost 0.5.10 supports node 0.12 but it seems that the email functionnality was not tested well before the release. After upgrading to the new version, suddenly emails wouldn't work anymore with an error message that
There was a problem with the server
I am using mailgun to send emails and the service is configured correctly.

Diagnosis of the issue

Checking SMTP connectivity

I first suspected that SMTP is blocked by my wonderful host, DigitalOcean, so I contacted their support and they promptly replied to my inquiry.

Easily setup a new SSD server within 55 seconds and get 10$ credit on DigitalOcean by using my Referral Link

DigitalOcean was not blocking the SMTP traffic and Jarland was kind enough to provide the iptables command to make sure that all ports are open.
iptables -I OUTPUT -p tcp --dport 25 -j ACCEPT (replace port 25 with the correct port for mailgun)
A quick telnet revealed that SMTP traffic is working fine but still sending emails from my blog is not working.

Debugging Ghost blog

With the above result, I suspected that something is wrong with a node package.
I stopped the service using
service ghost stop and then I run it again using npm start --production which will allow me to see any error details.
I tried sending an email and received an error message related to simplesmtp module used by nodemailer module.

Solution

NodeMailer was listing a dependency on simplesmtp version < 0.3.30.
Node 0.12 uses ECMAScript 6 (ES6) with which simplesmtp version 0.3.30 was not compatible.
In order to solve the problem use these steps:
* Stop ghost * Go to ghost/nodemodules/nodemailer/nodemodules and remove simplesmtp directory * edit package.json for the nodemailer module and change the dependency version for simplesmtp to 0.3.35 * reinstall simplesmtp module by running, in the nodemailer directory, npm install * relaunch Ghost service ghost start

Voila! You can now send emails again