cPanel服务器上创建的邮箱发邮件出去,任何邮箱都收不到。任何邮箱往cPanel服务器上创建的邮箱里发邮件,cPanel上的邮箱也收不到。MX记录和A记录都检查过了均很正常。后来看了下WHM中邮件统计发现提示lookuphost router failed to expand "${perl{mailtrapheaders: Undefined subroutine &main::mailtrapheaders called.\n
最终找到了问题的根源:服务器上的EXIM被装了两个不同的版本:
# rpm -qa | grep -i exim
exim-4.80.1-3.cp1136.x86_64
exim-4.82-2.cp1136.x86_64
于是卸载了下:
# rpm -e --nodeps --justdb exim-4.80.1-3.cp1136.x86_64
# rpm -e --nodeps --justdb exim-4.82-2.cp1136.x86_64
之后通过cPanel自带的rmp管理脚本修复了下系统:
# /scripts/check_cpanel_rpms --fix
exim started ok
Install Complete
Prelinking shared libraries and binaries: /usr/sbin/prelink -av -mR
Checking for and running RPM::Versions 'post' hooks for any RPMs just installed
warn [check_cpanel_rpms] program "/scripts/posteximup" is not executable
All required 'post' hooks have been run
Problems were detected with cPanel-provided files which are RPM controlled.
If you did not make these changes intentionally, you can correct them by running:
> /usr/local/cpanel/scripts/check_cpanel_rpms --fix
The following RPMs are missing from your system:
exim-4.82-2.cp1136
这之后发现发邮件不再提示上面那个错误了。同时将主机名(hostname)改成有效的主机名,重启服务器之后邮件功能恢复正常。