How can I use Exim4 to forward email for root to another email address?

6,474

The satellite configuration sends ALL email to the specified smarthost. No local delivery is considered, so the /etc/aliases file is not consulted.

If you want to have local delivery considered you should change the configuration type from satellite to smarthost.

Share:
6,474

Related videos on Youtube

Jaap Joris Vens
Author by

Jaap Joris Vens

Roads? Where we're going we don't need roads.

Updated on September 18, 2022

Comments

  • Jaap Joris Vens
    Jaap Joris Vens over 1 year

    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?