6

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 [email protected].

I instead want all email to root to be sent to [email protected], 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: [email protected]

And I've also put [email protected] 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 [email protected], which doesn't even exist.

How can I force email to root to go to [email protected]?

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 [email protected], 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: [email protected] entry and they always send root's mail to [email protected] no matter what I try. It also seems odd that a simple forwarding rule is so dependent on the mail servers main configuration?

LaVache
  • 343
  • 2
  • 4
  • 11
  • 1
    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 09 '15 at 21:19
  • Hi @roaima ... I've added more details as requested. Thanks. – LaVache Oct 10 '15 at 06:27
  • those settings are stored in /etc/default/exim4 – Jasen Oct 10 '15 at 09:17

2 Answers2

8

Your host doesn't sufficiently know that it is supposed to be qualified.example.com. A local delivery to root is rewritten as [email protected], 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 [email protected] it will consider this as local delivery. It will then check the /etc/aliases file and perform off-host delivery to [email protected] 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

roaima
  • 107,089
  • 14
  • 139
  • 261
  • 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 06:43
2

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).

roaima
  • 107,089
  • 14
  • 139
  • 261
Andy
  • 21
  • 1