从PHP发送邮件给出了不可路由的地址

时间:2014-04-02 02:41:16

标签: php email smtp exim4

我有一个运行PHP和Exim4的Debian服务器(当然还有其他东西)。 PHP应用程序每天发送1000封电子邮件,所有这些都可以正常工作,但我现在有了一个新客户,我的PHP / Exim4无法发送到此帐户。

PS我添加了--at--来阻止抓取工具找到地址。

  1. 我检查了exim4日志,发现了这个:
  2. 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
    
    1. 然后我使用以下方法检查了exim4中的路由:

      exim -d -f support --at-- sobs.com.au -bt az --at-- mentonegrammar

    2. 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地址错误。

      1. 然后我尝试了来自同一台服务器的命令行电子邮件。

        echo“测试消息”| mail -s“测试消息”az --at-- mentonegrammar

      2. 此电子邮件已根据需要运行并已到达,但我的PHP应用程序中的电子邮件仍然失败。

        1. 我检查了申请表:
        2. $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);
          
          1. 如上所述,此服务器和应用程序已成功发送了1000封电子邮件。

          2. Mentone Grammar的IT部门未收到任何其他电子邮件的任何问题。

          3. 总之,我一直回到exim4日志中的'Norouteableaddress'错误,并且调试输出指示地址是可路由的。我不禁想到Exim4配置存在一些问题 - 但我只是不知道。

            有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:0)

解决方案就是在这个问题上。该应用程序的原始条目具有#mentiegrammmar&#39;我后来的测试在哪里有#ment; mentonegrammar&#39;。我的浏览器记住了应用程序的错误输入并自动填写表单,我没有注意到。

感谢krisFR在ServerFault中的答案。