Some processes on my server send mail to various system accounts which all goes to root on the local machine. I want the root account to be an alias for my (external) email address. I'm using exim4 version 4.86_2

I have the following in /etc/aliases:

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: [email protected]

I've run the "newaliases" command, but when I send a mail to "root" it goes to root@localdomain.

How can I make the server read /etc/aliases or send system mail out to an external email address?

  • Do you have config for exim for smarthost? Feb 13, 2019 at 16:30
  • I think, but I'm not sure that it may be to do with exim not knowing what the local host name is. Just reading this: unix.stackexchange.com/questions/235112/… AH, yes it looks like that may have cured the problem Feb 13, 2019 at 16:32

2 Answers 2


It turns out that the host didn't know what the canonical name of the machine was, so was assuming all local mail was in fact remote. I've fixed it now as per this answer.


exim do not refer to the system aliases by default. You have to create the router that lookup the /etc/aliases and forward the message accordingly. This router should look like that:

    driver      = redirect
    data        = ${lookup{$local_part}lsearch{/etc/aliases}}
    user        = mailnull
    group       = mail
    file_transport  = address_file
    pipe_transport  = address_pipe

That router require the /etc/aliases file containing the lines of the next syntax:

localpart: alias
root:      user
other:     [email protected]
user:      john,mary,[email protected]

You can't use [email protected]: [email protected] as far as lookup searching for localpart only. If you need to use the whole address instead of localpart you have to change the lookup condition accordingly.

Keep in mind that routers should be listed in the proper order.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .