Debian/Ubuntu Tutorial for Elastic Email

Configure Ubuntu nullmailer to relay all local email through the Elastic Email cloud.

One of our customers provided us with a tutorial to use Elastic Email with Debian/Ubuntu.

Please use this tutorial as is, as it is not authored nor tested by Elastic Email.  If you have integrated Elastic Email into a product, system, or language we would love to have a look and if we publish the code/tutorials we will provide an Elastic Email credit in your account up to 50,000 emails.

Debian/Ubuntu nullmailer with ElasticEmail

This tutorial is aimed to use nullmailer to relay all local email through ElasticEmail cloud. This is useful if you don't want to rewrite your applications to use the API but want to use the awesome cloud delivery network of ElasticEmail.

Note: Nullmailer is a superb sendmail replacement with ElasticEmail. If an application wants to use SMTP directly, however, it needs to be configured for ElasticEmail directly. Nullmailer only replaces sendmail and does not provide a local SMTP daemon.

To install nullmailer, use the following command. This will suggest to remove your previous installed mailer (exim4, postfix, etc.) but not purge it (so config files remain – if you want).

Sudo apt-get install nullmailer

While installing, debconf should pop-up. If debconf does not pop-up, you can use the configfiles in /etc/nullmailer later. The corresponding config files are listed with each dialogue.

The first dialogue asks for your mail-name of the system (config file: /etc/mailname).
The default should work here, otherwise, enter your hostname and choose "Ok".
The next dialogue asks for the smarthost to use for delivery (config file: /etc/nullmailer/remotes), which is ElasticEmail obviously, enter the following: smtp --port=2525 --user=YOURUSERNAME --pass=YOURAPIKEY

In the last dialogue, you can configure the delivery of local messages (config file: /etc/nullmailer/adminaddr), like "somebody@localhost" which ElasticEmail would not be able to deliver. Enter a suitable email address for this case here.

If nullmailer was not automatically started, use the following command:

sudo /etc/init.d/nullmailer start

If you change the configfiles, use the following command to restart nullmailer:

sudo /etc/init.d/nullmailer restart

To test the delivery, use the commandline "mail"-tool (make sure the package "mailutils" is installed):

mail -s "test subject"

and follow the instructions (enter the message, finish with Ctrl+D). Check the ElasticEmail interface and your inbox if everything went ok.

© Copyright Thomas Lutz