Exim:发送给 root 的电子邮件会忽略 /etc/aliases 和 /root/.forward - 始终使用限定域名

LaV*_*che 6 ubuntu email exim

dpkg-reconfigure exim4-config要求一个域名来“限定”本地用户的电子邮件地址,例如root. 假设我已将此设置设置为qualified.example.com- 这会导致发送到的所有电子邮件仅root转到root@qualified.example.com.

我希望将所有电子邮件root发送到example@gmail.com,但qualified.example.com由于其他原因,我希望将限定域名设置保留为 。

我已将此行添加到 /etc/aliases

root: example@gmail.com
Run Code Online (Sandbox Code Playgroud)

我也投入example@gmail.com/root/.forward

我已经运行newaliases并重新启动了exim,但是无论我做什么,mail to 都会root继续尝试发送到root@qualified.example.com,而这甚至不存在。

如何强制电子邮件root转到example@gmail.com

这是在 Ubuntu Server 14.04 上

我的/etc/exim4/update-exim4.conf.conf看起来像这样:

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'              
Run Code Online (Sandbox Code Playgroud)

当我跑步时,dpkg-reconfigure exim4-config我像这样回答了合格的域问题:

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_________
Run Code Online (Sandbox Code Playgroud)

虽然该设置没有出现在/etc/exim4/update-exim4.conf.conf. 应该是?

我注意到同样的问题也发生在我的 Debian 服务器上。我一定完全误解了 Exim 和/或/etc/aliases文件,因为它们似乎都忽略了我的/etc/aliasesroot: example@gmail.com 条目,并且无论我尝试什么,它们总是将 root 的邮件发送到 root@qualified.example.com。一个简单的转发规则如此依赖于邮件服务器的主要配置似乎也很奇怪?

roa*_*ima 7

您的主机并没有充分知道它应该是qualified.example.com. 本地传递到root被重写为root@qualified.example.com,这被(错误地)认为是在其他地方,因此尝试进行脱离主机传递。

您需要完成该过程,告知exim4您的本地主机确实是qualified.example.com。然后,当它交付给 时root,重写为root@qualified.example.com它会认为这是本地交付。然后它将检查/etc/aliases文件并example@gmail.com按照您的指示执行脱离主机交付。

让我们假设您的主机的真实 DNS 名称是myhost.contoso.com. 重新运行dpkg-reconfigure exim4-config并包含这些设置:

  • 系统邮件名称: myhost.contoso.com
  • 接受[本地]邮件的其他目的地: myhost : qualified.example.com
  • 用于中继邮件的域:{empty}
  • 中继邮件的机器:{empty}

然后运行update-exim4.confinvoke-rc.d exim4 restart