This post will detail configuring a basic Exim MTA for relaying through an external SMTP server (e.g. your ISP). It should be noted that this is an unsecured method (not using SSL or TLS) so in theory your username and password could be seen by a third party.  I only use this for adhoc basic alerts from the Pi and have set up a separate mailbox on my ISP (with its own username and password) instead of using my primary ISP details.

First install the Exim package:

$ sudo apt-get install exim4

When the exim4 service first started after installation I received a panic from the daemon around IPV6:

IPv6 socket creation failed: Address family not supported by protocol

I had to perform the following:

  1. Edit the file /etc/exim4/update-exim4.conf.conf (e.g. with nano)
    $ sudo nano /etc/exim4/update-exim4.conf.conf
  2. Remove ::1 from dc_local_interfaces section
  3. Save and exit
  4. Delete the paniclog:
    $ sudo rm /var/log/exim4/paniclog
  5. Reconfigure Exim:
    $ sudo update-exim4.conf
  6. Restart Exim service:
    $ sudo service exim4 restart

Reconfigure the Exim package (easier to set all the basic options):

$ sudo dpkg-reconfigure exim4-config

Answer the following selections (you may adjust these as you see fit):

  • Select mail sent by smarthost; received via SMTP or fetchmail
  • Leave as default (this will be the hostname of your server)
  • Leave as default (this will be
  • Leave as default (this will be the hostname of your server)
  • Leave this field blank for now (this allows other hosts to relay through exim)
  • Enter your Broadband providers SMTP/relay address (e.g.
  • I chose to not hide header information (No)
  • Accept the default for DNS lookups (No)
  • I selected the mbox format for mailboxes.
  • I selected the default here of unsplit configuration files.
  • I entered my current Linux username in the recipient for root and postmaster mail.

Edit the following file and ensure you use your legitimate ISP domain name (e.g


$ sudo nano /etc/email-addresses




NOTE: If you came to this post from one of my Icinga guides, please ensure you add your Icinga user.  This will be either icinga or nagios.  You can find this out with the following: $ grep -E “(icinga|nagios)” /etc/passwd

Reconfigure Exim and then restart the service:

$ sudo update-exim4.conf

$ sudo service exim4 restart

You can test this functionality with the following:

$ mail -s “Test” <your_own_email_address> -v

Type some text and hit Enter.  When finished, enter a period on a new line and hit Enter to send.  The -v above will show you a verbose output of the connection to your ISP.

I’ve added a couple of lines of code to my rc.local file on the Pi to email me the IP address when it starts up.  This is useful when it’s on a DHCP network (or just to confirm the network is up and operational).

You can look at /var/log/exim4/mainlog for additional logging details.

Depending on your ISP relay rules you may need to authenticate to your ISP as well.  If so perform these additional steps and then reconfigure and restart Exim (as described above):

Create and edit the following file:


$ sudo nano /etc/exim4/exim4.conf.localmacros

Add the following line then save and exit:


Edit the following file:


$ sudo nano /etc/exim4/passwd.client




Basic Exim MTA relay on Raspberry Pi with Raspbian
Tweet about this on TwitterShare on Google+0Share on Facebook0Email this to someone
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *