Exim4 is a MTA or message transfer agent that runs on Linux systems. It’s freely available under GNU Linux. If you need to run mail from a server or send an email through an app, you’ll need to install Exim4. It can be installed in place of Sendmail or Postfix.

To install Exim4, open up your Terminal.

<pre lang="bash">$ sudo apt install exim4

Configure Exim4.

<pre lang="bash">$ sudo dpkg-reconfigure exim4-config

You’ll be asked several questions.

  1. Select “internet site” for type of mail configuration.
  2. Enter your domain name when asked about system mail name.
  3. Answer “127.0.0.1 ; ::1” when asked about incoming SMTP connections
  4. Answer the default answers for the next 3 questions.
  5. Answer “No” for Dial on demand.
  6. Answer “mbox” for delivery method for local mail.
  7. Answer “yes” to split configuration into small files.

If you need to reconfigure Exim4, just re-run the reconfigure command.

Don’t try to edit the /var/lib/exim4/config.autogenerated file.

Test if Exim4 is sending out emails.

<pre lang="bash">
$ mail -s "Your Subject" recepient@email.com
$ Hello there. This is the body of the message.

Type Ctrl-D to send the message.

Another way to test if Exim4 is working is to use WordPress. There’s a lost password link below the login page. Click on that. Supply a valid user email address. You should received an email directly from WordPress.