I'm running a Ubuntu 12.04lts server with denyhosts, logwatch, apticron etc daemons which send emails to a user on the machine when something happens.

Since I don't use the root account; I aliassed everything which goes to the root to my own superuser account:

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: richard

The mail now gets delivered to my richard account. To forward every mail externally I added this line:

richard: richard@domain.com, richard

The hostname of the server is srv1.domain.com. I don't want to receive external mail on this machine. I just want the local mail originating from the machine being forwarded to my, hosted on google business apps, remote mail.

How can I configure exim (at least I think that is the default MTA of ubunutu) to do the above?


It's easiest to run dpkg-reconfigure exim4-config. For the first question (what type of mail configuration), you can probably just leave whatever is selected. For the second question (what IP addresses to listen on), you want it to listen on and ::1 (the ipv4 localhost and the ipv6 localhost). Answer the rest of the questions and save.

Since Ubuntu just repackages the Debian version of exim4, you should read the detailed Debian instructions located at http://pkg-exim4.alioth.debian.org/README/README.Debian.html. This same file is usually locally installed on your system at /usr/share/doc/exim4-config/README.Debian.gz too.

  • Thank you! After all it was fairly simple answering the questions of exim4-config! So I don't have to be afraid the server will be used for spam if I pu the listen addresses on and ::1 ? – stUrb Apr 6 '13 at 2:17
  • It won't be used for spamming by connecting from the outside to your mail server via smtp. However, you also need to make sure that any webpages that you have on your webserver don't send mail based on user input into forms. THAT is also a big exploitable source of spam. – Todd Lyons Apr 10 '13 at 20:10

You can:

Make exim accept SMTP connections only on loopback interface ( - see local_inteffaces configuration option. It is a pretty common default MTA configuration.


Turn off waiting/accepting SMTP connections.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.