Configure exim4 to send mail to other hosts

If you have just installed Debian (or other Linux) you might be stumped as to why sending e-mails from web software (such as forum activation e-mails) is not working. The reason is that by default the exim4 mail software is setup not to forward any mail to any remote hosts. This of course is an excellent anti-spam measure, but not very useful if you really need a server to send mail out to the world.

The solution is really simple. Edit the file /etc/exim4/update-exim4.conf.conf and change the following line:




Then restart exim4 and you’re done! To test if it really works, first create a file called “testmail” that looks like this:

Subject: exim4 mail test
(blank line)

The “(blank line)” must obviously be a real blank line. Just press enter a few times and save the file. Then try to send it with the following command:

sendmail -v < testmail

Change the e-mail address into your own working e-mail address (like a Gmail account or something). The output of the sendmail command will give you a very detailed overview on how the e-mail was sent (or not). If the test was successful you’ll find the mail in your mailbox in a few minutes.