Forwarding root emails: /etc/aliases file is being ignored

July 8, 2018 68 views
Email Ubuntu 16.04

I set up an Ubuntu 16.04 droplet to host my client's website (let's call it clientwebsite.com). I also helped him set up G Suite email hosting for his new business email (let's call it client@clientwebsite.com). In his G Suite settings, we set up a catch all so that all emails to @clientwebsite.com addresses are forwarded to client@clientwebsite.com.

The Ubuntu server uses exim4 to send emails. I thought I configured it to send all server-related emails to me (let's call me developer@studio.com). I ran sudo dpkg-reconfigure exim4-config which resulted in a /etc/exim4/update-exim4.conf.conf file like this:

dc_eximconfig_configtype='internet'
dc_other_hostnames='clientwebsite.clientwebsite.com; clientwebsite; localhost.localdomain; localhost'
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

And I edited the /etc/aliases file to look like this:

mailer-daemon: developer@studio.com
postmaster: developer@studio.com
nobody: developer@studio.com
hostmaster: developer@studio.com
usenet: developer@studio.com
news: developer@studio.com
webmaster: developer@studio.com
www: developer@studio.com
ftp: developer@studio.com
abuse: developer@studio.com
noc: developer@studio.com
security: developer@studio.com
root: developer@studio.com
jessica: developer@studio.com
monit: developer@studio.com

Then ran the newaliases command and restarted exim4 with sudo service exim4 restart.

All root emails are ending up in my client's inbox (client@clientwebsite.com), due to the catch all we set up in G Suite. I expected the server to read the /etc/aliases file and send them to me (developer@studio.com) instead... but it seems this file is being completely ignored!

How can I make sure all server-related emails are sent to me instead of my client?

Thanks!

1 Answer

Hello friend!

It looks like you are on the right track, but there may be just a bit more work left. I had in my head the rough idea but not quite the words or steps, so I did a bit of searching and I found someone who explained it perfectly:

https://unix.stackexchange.com/a/235300

I do think that this is merely a hostname issue, and that clearing it up as indicated there should set everything to working as intended.

Kind Regards,
Jarland

  • Thanks so much for your reply. I actually came across this article myself and triple-checked my exim config, but I think I have everything set correctly?

    In dpkg-reconfigure exim4-config, I set the system mail name as clientwebsite.com and other destinations for which mail is accepted as hostname.clientwebsite.com; hostname; localhost.localdomain; localhost. Is that not correct?

Have another answer? Share your knowledge.