Developers often have to do it all, which means configuring SMTP on their Development or Cloud Server so they can get back to coding their email app. For Linux users the best and easiest package to install on their server to support outbound SMTP is Exim. In this post we're going to go over a few helpful configuration notes for developers.
Here's our environment: Linux Cloud Server hosted with Linode, running Ubuntu 14.04 LTS.
Linode has excellent documentation, and their Exim4 Installation Guide is no exception. It's a good place to start. Essentially you install Exim4 and mailUtils…
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install exim4-daemon-light mailutils
…and configure Exim4 as sudo.
$ sudo dpkg-reconfigure exim4-config
This will walk you through a series of screens like this one, all of which are shown on the Linode Exim4 page.
Here's an important point. You'll be listing your system’s FQDN (fully qualified domain name) in the mail name configuration screen in the 2nd Exim4 configuration screen. Make sure your server's Reverse DNS name is listed here, and secondarily, that your fully configured Reverse DNS is correctly set in your Cloud Server Configuration.
The FQDN below is archimedes.palegray.net. In this example palegray.net would be the primary domain you assigned to your Linux Cloud server. archimedes would be the name you gave your Linux server. So with that info you'll want to make sure your Server's Reverse DNS for both IPv4 and IPv6 is archimedes.palegray.net. On Linode you configure that on the “Remote Access” page.
The conventional approach to testing your Exim4 configuration is the following.
$ echo "This is a test." | mail -s Testing email@example.com
Most guides end there, but you'll want to follow up by checking on the test results in the Exim Logs with
$ tail /var/log/exim4/mainlog
That will let you know if your mail was sent to where you hoped or if there are issues you need to deal with.
If you have problems after a reconfiguration session, cleaning out the Exim4 DB folder may help.
$ sudo service exim4 stop
$ cd /var/spool/exim4/db/
$ sudo rm *
$ sudo service exim4 start
For some reason, my domain which was NEVER used for sending email or any other Internet service, was marked as “suspicious” and thus any email sent to outlook.com was rejected. This was revealed when viewing the tail of the exim4 mainlog we covered earlier. This was easily resolved by completing a Sender Information to Outlook.com Form with Microsoft, who actually handled it pretty quickly.
The tips in this post should be enough to help developers quickly configure Exim4 and get back to coding. I'll be using this post as a personal reference in the future, so if anything changes or if I discover any new tips, I will add them here.