Jens Segers on Oct 04 2015

Easy system email relay with Nullmailer and Mandrill

Installing and configuring Postfix or Exim often feels like rocket science to get everything set up without any security holes. But those days are over; meet the awesome Nullmailer + Mandrill combo!


Nullmailer provides a sendmail compatible email interface that can forward emails to an external SMTP server. This allows you to leverage a third party service like Mandrill to handle all your mail traffic with a pretty admin interface to monitor everything.

Start by installing the nullmailer package:

apt-get install nullmailer

When that's done, there are only a few files that need to be modified. The first one is /etc/nullmailer/remotes where you specify the remote SMTP server. You can find your SMTP credentials in the Mandrill settings section. smtp --port=587 --starttls --user=<email> --pass=<password>

Then modify and execute these commands to fit your configured Mandrill domain:

sudo echo "" > /etc/mailname
sudo echo "" > /etc/nullmailer/defaultdomain
sudo echo "" > /etc/nullmailer/me
sudo echo "[email protected]" > /etc/nullmailer/adminaddr

Now reload Nullmailer and you are ready to go!

sudo service nullmailer reload

To test if everything is working correctly, try sending an email to yourself:

echo "Hello world from $HOSTNAME" | sendmail [email protected]


jenssegers 1 year ago

@Alexey Shockov That's correct, but configuring Nullmailer with Chef was so much easier compared to Exim or Postfix.

Alexey Shockov 1 year ago

Exim and Postfix are usable too. Many services, like SendGrid and Mandrill, offer tutorials for them, because they are default MTA in the most Linux systems (Exim in Debian based and Postfix in Red Hat based).

cedricverst 1 year ago

Nice :)

Maurus 1 year ago

I use for that purpose, which is also very easy to setup.