Email is far from a perfect communication medium for all use cases but it is still a really good option for low volume alerts from your security monitoring gear.
In this article we will quickly show how to set up Exim 4 as a basic mail relay on a Ubuntu server.
Exim Installation
$ sudo apt-get install exim4
Configuration
On Debian and Ubuntu, Exim 4 is configured most easily using a template system. This is found in /etc/exim4. The basic idea is to change the /etc/exim4/update-exim4.conf.conf file and then run the template generation over it.
Smarthost
The following configuration sets up Exim to send via a Smarthost, i.e. another mail server. This is most common on an internal network. In this case, the host nsm.4armed.com is being configured to send via smarthost.4armed.com. You should obviously configure these values accordingly.
dc_eximconfig_configtype='satellite'
dc_other_hostnames='nsm'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost='4armed.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smarthost.4armed.com'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
Now update the configuration files and restart Exim.
$ cd /etc/exim4
$ sudo update-exim4.conf
$ sudo /etc/init.d/exim4 restart
Send yourself a test.
$ echo "This is a test" | mailx -s "Test Message" -v yourname@yourdomain.com