I am trying to forward system email (from apt, cron, etc.) addressed to "root" to my personal email address using a smarthost. I am using Debian 9. First, I ran sudo dpkg-reconfigure exim4-config
. This is the contents of /etc/exim4/update-exim4.conf.conf
(I replaced all occurrences of my domain name with "example.com"):
dc_eximconfig_configtype='satellite'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost='example.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='mail.messagingengine.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
I also set the correct password in /etc/exim4/passwd.client
I can now successfully send mail to any email address with sendmail
, mailx
, etc.
Second, I edited /etc/aliases
to contain the following:
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]
But, when I try to send an email to "root" with echo Hi | mailx root
I see the following error in /etc/exim4/mainlog
:
SMTP error from remote mail server after RCPT TO:<[email protected]>: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table
I thought I told Exim4 to redirect email for root to "[email protected]". But instead it is redirecting it to "[email protected]". Why is Exim4 not honouring my /etc/aliases
? How should I setup Exim4 to redirect email for root to my personal email address?