我有一个运行 PHP 和 Exim4 的 Debian 服务器(当然还有其他)。PHP 应用程序每天发送 1000 封电子邮件,一切正常,但是我现在有一个新客户,我的 PHP/Exim4 无法发送到该帐户。
PS 我添加了 --at-- 来阻止爬虫查找地址。
- 我检查了 exim4 日志,发现:
2014-04-02 08:48:10 1WV7TW-0001Em-Od <= support --at-- sobs.com.au H=localhost [127.0.0.1] P=esmtp S=1215 2014-04-02 08:48:11 1WV7TW-0001Em-Od ** az --at-- mentonegrammmar: Unrouteable address 2014-04-02 08:48:11 1WV7TW-0001Em-Od Completed
然后我使用以下命令检查了 exim4 中的路由:
exim -d -f 支持 --at-- sobs.com.au -bt az --at-- mentonegrammar
Exim version 4.80 uid=0 gid=0 pid=12506 D=fbb95cfd Berkeley DB: Berkeley DB 5.1.29: (October 25, 2011) Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd Authenticators: cram_md5 plaintext Routers: accept dnslookup ipliteral manualroute queryprogram redirect Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp Fixed never_users: 0 Size of off_t: 8 Compiler: GCC [4.7.2] Library version: GnuTLS: Compile: 2.12.20 Runtime: 2.12.20 Library version: PCRE: Compile: 8.31 Runtime: 8.30 2012-02-04 Total 13 lookups WHITELIST_D_MACROS: "OUTGOING" TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs" changed uid/gid: forcing real = effective uid=0 gid=0 pid=12506 auxiliary group list: none seeking password data for user "uucp": cache not available getpwnam() succeeded uid=10 gid=10 changed uid/gid: calling tls_validate_require_cipher uid=101 gid=103 pid=12507 auxiliary group list: none tls_validate_require_cipher child 12507 ended: status=0x0 configuration file is /var/lib/exim4/config.autogenerated log selectors = 00000ffc 00612001 trusted user admin user seeking password data for user "mail": cache not available getpwnam() succeeded uid=8 gid=8 user name "root" extracted from gecos field "root" originator: uid=0 gid=0 login=root name=root sender address = root --at-- ds6419.hostname.net.au Address testing: uid=0 gid=103 euid=0 egid=103 Testing az --at-- mentonegrammar Considering az --at-- mentonegrammar routing az --at-- mentonegrammar -------- hubbed_hosts router -------- local_part=az domain=mentonegrammar checking domains expansion of "${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail}" forced failure: assume not in this list hubbed_hosts router skipped: domains mismatch -------- dnslookup_relay_to_domains router -------- local_part=az domain=mentonegrammar checking domains search_open: dsearch "/etc/exim4/virtual" search_find: file="/etc/exim4/virtual" key="mentonegrammar" partial=-1 affix=NULL starflags=0 LRU list: 5/etc/exim4/virtual End internal_search_find: file="/etc/exim4/virtual" type=dsearch key="mentonegrammar" file lookup required for mentonegrammar in /etc/exim4/virtual lookup failed mentonegrammar.net in "@:localhost:dsearch;/etc/exim4/virtual"? no (end of list) mentonegrammar.net in "empty"? no (end of list) mentonegrammar.net in "! +local_domains : +relay_to_domains"? no (end of list) dnslookup_relay_to_domains router skipped: domains mismatch -------- dnslookup router -------- local_part=az domain=mentonegrammar checking domains cached no match for +local_domains cached lookup data = NULL mentonegrammar in "! +local_domains"? yes (end of list) R: dnslookup for az@mentonegrammar calling dnslookup router dnslookup router called for az --at-- mentonegrammar domain = mentonegrammar DNS lookup of mentonegrammar (MX) succeeded DNS lookup of mail.mentonegrammar (AAAA) gave NO_DATA returning DNS_NODATA DNS lookup of mail.mentonegrammar (A) succeeded 58.96.103.231 in "0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :255.255.255.255"? no (end of list) fully qualified name = mentonegrammar host_find_bydns yield = HOST_FOUND (2); returned hosts: mail.mentonegrammar 58.96.103.231 MX=5 set transport remote_smtp queued for remote_smtp transport: local_part = az domain = mentonegrammar errors_to=NULL domain_data=NULL localpart_data=NULL routed by dnslookup router envelope to: az --at-- mentonegrammar transport: remote_smtp host mail.mentonegrammar [58.96.103.231] MX=5 search_tidyup called =============== Exim pid=12506 terminating with rc=0 =============== az --at-- mentonegrammar router = dnslookup, transport = remote_smtp host mail.mentonegrammar [58.96.103.231] MX=5
这看起来好像路由工作正常。我再次尝试了应用程序电子邮件,但仍然收到 Unrouteable address 错误。
然后我尝试了来自同一台服务器的命令行电子邮件。
echo "测试信息" | mail -s "测试信息" az --at--mentonegrammar
此电子邮件按要求工作并到达,但来自我的 PHP 应用程序的电子邮件仍然失败。
- 我检查了应用程序:
$mime = new Mail_mime(); $formattedHeaders = $mime->headers($headers); $mime->setHTMLBody($body); $content = $mime->get(array('html_charset' => 'utf-8')); $smtp = Mail::factory("smtp", array()); $result = $smtp->send($headers["To"], $formattedHeaders, $content);
如前所述,此服务器和应用程序成功发送了 1000 封电子邮件。
Mentone Grammar 的 IT 人员在接收任何其他电子邮件时没有表示任何问题。
总之,我不断回到 exim4 日志中的“无法路由地址”错误,并且调试输出表明该地址是可路由的。我不禁想到 Exim4 配置有问题——但我就是不知道。
有人可以指出我正确的方向吗?