5

dpkg-reconfigure exim4-config asks for a domain name to "qualify" email addresses of local users such as root. Let's say I've set this setting to qualified.example.com - this causes all email sent to simply root to go to root@qualified.example.com.

I instead want all email to root to be sent to example@gmail.com, but I want the qualified domain name setting left set to qualified.example.com for other reasons.

I've added this line to /etc/aliases

root: example@gmail.com

And I've also put example@gmail.com in /root/.forward

I've run newaliases and restarted exim, but no matter what I do, mail to root continues to always try to send to root@qualified.example.com, which doesn't even exist.

How can I force email to root to go to example@gmail.com?

This is on Ubuntu Server 14.04

My /etc/exim4/update-exim4.conf.conf looks like this:

dc_eximconfig_configtype='internet'               
dc_other_hostnames=''                             
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'              

When I ran dpkg-reconfigure exim4-config I answered the qualified domain question like so:

The 'mail name' is the domain name used to 'qualify' mail addresses without a domain name.                  

This name will also be used by other programs. It should be the single, fully qualified domain name (FQDN). 

Thus, if a mail address on the local host is foo@example.org, the correct value for this option would be    
example.org.                                                                                                

This name won't appear on From: lines of outgoing messages if rewriting is enabled.                         

System mail name:                                                                                           

qualified.example.com_________

Although that setting doesn't appear in /etc/exim4/update-exim4.conf.conf. Should it?

I've noticed that the same issue happens on my Debian servers too. I must be completely misunderstanding something about Exim and/or the /etc/aliases file, because they all seem to ignore my /etc/aliases root: example@gmail.com entry and they always send root's mail to root@qualified.example.com no matter what I try. It also seems odd that a simple forwarding rule is so dependent on the mail servers main configuration?

  • Please could you include a copy of your /etc/exim4/update-exim4.conf.conf in your question, and also indicate if you have edited any other configuration file in the /etc/exim4 directory. I suspect you've simply omitted to tell your local server that it itself is qualified.example.com, but when I see your update-exim4.conf.conf I'll be able to confirm that. – roaima Oct 9 '15 at 21:19
  • Hi @roaima ... I've added more details as requested. Thanks. – LaVache Oct 10 '15 at 6:27
  • those settings are stored in /etc/default/exim4 – Jasen Oct 10 '15 at 9:17
7

Your host doesn't sufficiently know that it is supposed to be qualified.example.com. A local delivery to root is rewritten as root@qualified.example.com, which is (wrongly) considered to be elsewhere, so an off-host delivery is attempted.

You need to complete the process telling exim4 that your local host really is qualified.example.com. Then, when it delivers to root, rewritten as root@qualified.example.com it will consider this as local delivery. It will then check the /etc/aliases file and perform off-host delivery to example@gmail.com per your instructions.

Let's assume your host's real DNS name is myhost.contoso.com. Rerun dpkg-reconfigure exim4-config and include these settings:

  • System mail name: myhost.contoso.com
  • Other destinations for which [local] mail is accepted: myhost : qualified.example.com
  • Domains to relay mail for: {empty}
  • Machines to relay mail for: {empty}

Then run update-exim4.conf and invoke-rc.d exim4 restart

  • Hey thanks for your help on this. This did solve the issue on a Debian server, but in the end this problem on the Ubuntu server seemed to be caused by VestaCP, so I should have mentioned that I was running that. For anyone else with the same problem running VestaCP, you need to add your version of "qualified.example.com" as a mail domain in the VestaCP control panel for some reason, otherwise root's forwarding won't work and gives the following error in the Exim mainlog: remote host address is the local host – LaVache Oct 11 '15 at 6:43
0

Although that setting doesn't appear in /etc/exim4/update-exim4.conf.conf. Should it?

That setting goes to /etc/mailname file. As long as the first (and only) line of /etc/mailname matches your /etc/hosts, it will be considered as a local delivery. E.g. you wanna use qualified.example.com, so you should have it in your /etc/mailname file and it should also be defined in /etc/hosts file, like: 127.0.0.1 qualified.example.com. Be sure to define the same for ipv6 in your hosts file (or disable ipv6 for exim if you don't use it).

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.