Before anyone asks, yes, I've read the other 50 threads about this, but none have worked. (And my reputation is low enough that I can't seem to comment on existing threads, hence having to restart this post again.)

I've sucessfully set up mdadm forwarding to servermonitoring@example.org (hosted by Google) using exim4, but any emails sent to root refuse to route correctly. All end up being sent straight out to root@example.org, which blows up, as it does not currently exist. I've run newalises, restarted exim4, etc, and no joy. I know this has to be simple, but I am just not quite understanding what the problem is.

Couple quick notes before the config files appear:

  1. rDNS is not set up, as this is a random server at home. (MX record for the domain points to gmail, as gmail is handling the actual domain email hosting.)
  2. This thread seems to be close to correct, but my server's hostname is not of the format asdf.example.org, so I'm not quite sure how to translate it. (Various attempts haven't quite worked.)

System hostname:

root@zetaServer:~# hostname

Contents of /etc/aliases:

postmaster:    root
root: servermonitoring@example.org, /root/mailbox

Contents of /root/.forward:


Contents of /etc/exim4/update-exim4.conf.conf:

dc_local_interfaces=' ; ::1'

Contents of /var/log/exim4/mainlog after sending a test email:

root@zetaServer:~# echo test | mail -s "test message" root
root@zetaServer:~# tail /var/log/exim4/mainlog -n 3
2016-11-24 20:55:29 1cA7bl-0006Xf-K0 <= root@example.org U=root P=local S=482
2016-11-24 20:55:30 1cA7bl-0006Xf-K0 => root@example.org R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [] X=TLS1.2:RSA_AES_128_CBC_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com" A=gmail_login C="250 2.0.0 OK 1480046130 c15sm63433639pfd.36 - gsmtp"
2016-11-24 20:55:30 1cA7bl-0006Xf-K0 Completed

Gmail Error:

Delivery to the following recipient failed permanently:


I know I have to be close... Just need a little help.

  • Are you sure that exim use /etc/exim4/update-exim4.conf.conf configuration file? – Mikhail Khirgiy Nov 25 '16 at 5:29

As you are on a home network, it is unlikely that you will get valid rDNS, and your hostname likely won't be valid. Although, you should have something like myhost.example.org.

Try configuring a password entry for gmail in /etc/exim/passwd.client. Check the auth configuration to verify that the client authentication code is not commented out. (I believe it is enabled by default.) Use valid credentials for your gmail account.

Check your log file(s) in /var/log/exim4 for any messages that indicate why the message failed. The failed messages should have been bounced to a local account. The log file should show a local delivery of the bounce message.

Exim will not deliver as root, so if you want local delivery for root use real-root as the local address. It is best to alias root to a local user and have that user aliased for remote delivery. Bounces and local deliveries can then be done more easily. For local delivery when using the smarthost setup, prefix the desired user with real- which will bypass the remote alias.

  • So I have a valid email address and password. Emails to servermonitoring@example.org work just fine. Seems to be an issue with exim4 not redirecting emails destined for root to that address for some reason. Also, you can see above that there was no error in the exim4 log. The issue is that exim4 isn't rewriting the root emails to the valid account before firing them out. – ZetaSyanthis Dec 4 '16 at 10:23
  • @ZetaSyanthis Most system processes mail eventually get redirected to root. You should have an entry in /etc/aliases to redirect root something like root : servermonitoring@example.org. – BillThor Dec 5 '16 at 1:43

AHA! I figured it out!

I needed to set the hostname of my server itself (zetaServer) as the system mail name rather than example.org! :)

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.