0

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: me@mydomain.com

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? – Romeo Ninov Feb 13 '19 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 – TommyPeanuts Feb 13 '19 at 16:32
1

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:

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

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

localpart: alias
root:      user
other:     me@domain.tld
user:      john,mary,bob@other.tld

You can't use me@domain.tld: me@another.tld 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.

| improve this answer | |
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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