Exim无法发送到远程邮件服务器

我正在使用centos5.6自定义构build的exim(捆绑在afterlogic pro mailsuite中)。 系统无法发送到远程邮件服务器,如雅虎或Gmail,并给出了这个错误:

[email protected] R=dnslookup defer (-1): host lookup did not complete 

我可以用dig命令查找gmail.com dnslogging:

  #dig mx gmail.com ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> mx gmail.com ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2234 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;gmail.com. IN MX ;; ANSWER SECTION: gmail.com. 3600 IN MX 30 alt3.gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 20 alt2.gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 5 gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 10 alt1.gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 40 alt4.gmail-smtp-in.l.google.com. ;; Query time: 16 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Fri Mar 16 16:23:27 2012 ;; MSG SIZE rcvd: 150 

我用exim运行了一个debugging命令,它是这样的:

  #bin/exim -bt -d-resolver [email protected] Exim version 4.76 uid=0 gid=0 pid=2368 D=fbb95cfd Berkeley DB: Berkeley DB 5.2.36: (September 14, 2011) Support for: crypteq iconv() OpenSSL Content_Scanning DKIM Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz mysql Authenticators: cram_md5 plaintext spa Routers: accept dnslookup ipliteral manualroute queryprogram redirect Transports: appendfile/maildir autoreply pipe smtp Fixed never_users: 0 Size of off_t: 8 Compiler: GCC [4.1.2 20080704 (Red Hat 4.1.2-51)] Library version: OpenSSL: Compile: OpenSSL 1.0.0e 6 Sep 2011 Runtime: OpenSSL 1.0.0e 6 Sep 2011 Library version: PCRE: Compile: 8.13 Runtime: 8.13 2011-08-16 Total 7 lookups Library version: MySQL: Compile: 5.1.56 [Source distribution] Runtime: 5.1.56 WHITELIST_D_MACROS unset TRUSTED_CONFIG_LIST unset changed uid/gid: forcing real = effective uid=0 gid=0 pid=2368 auxiliary group list: <none> seeking password data for user "exim": cache not available getpwnam() succeeded uid=3000 gid=3000 seeking password data for user "root": cache not available getpwnam() succeeded uid=0 gid=0 configuration file is /usr/mailsuite/etc/exim log selectors = 0000cefe 00233821 trusted user admin user seeking password data for user "exim": cache not available getpwnam() succeeded uid=3000 gid=3000 seeking password data for user "exim": using cached result getpwnam() succeeded uid=3000 gid=3000 seeking password data for user "exim": using cached result getpwnam() succeeded uid=3000 gid=3000 originator: uid=0 gid=0 login=root name=root sender address = [email protected] Address testing: uid=0 gid=3000 euid=0 egid=3000 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Testing [email protected] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Considering [email protected] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> routing [email protected] --------> dnslookup router <-------- local_part=someuser domain=gmail.com checking domains search_open: mysql "NULL" search_find: file="NULL" key="SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 " partial=-1 affix=NULL starflags=0 LRU list: internal_search_find: file="NULL" type=mysql key="SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 " database lookup required for SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 MySQL query: SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 MYSQL new connection: host=localhost port=0 socket=/usr/mailsuite/tmp/mysql.sock database=exim user=root MYSQL: no data found lookup failed gmail.com in ""? no (end of list) gmail.com in "! +local_domains"? yes (end of list) calling dnslookup router dnslookup router called for [email protected] domain = gmail.com DNS lookup of gmail.com (MX) succeeded DNS lookup of gmail-smtp-in.l.google.com (A) succeeded DNS lookup of alt1.gmail-smtp-in.l.google.com (A) succeeded DNS lookup of alt2.gmail-smtp-in.l.google.com (A) succeeded DNS lookup of alt3.gmail-smtp-in.l.google.com (A) succeeded DNS lookup of alt4.gmail-smtp-in.l.google.com (A) succeeded fully qualified name = gmail.com host_find_bydns yield = HOST_FOUND (2); returned hosts: gmail-smtp-in.l.google.com 209.85.225.27 MX=5 alt1.gmail-smtp-in.l.google.com 173.194.76.27 MX=10 alt2.gmail-smtp-in.l.google.com 74.125.115.27 MX=20 alt3.gmail-smtp-in.l.google.com 173.194.67.26 MX=30 alt4.gmail-smtp-in.l.google.com 173.194.65.26 MX=40 set transport remote_smtp queued for remote_smtp transport: local_part = someuser domain = gmail.com errors_to=NULL domain_data=NULL localpart_data=NULL routed by dnslookup router envelope to: [email protected] transport: remote_smtp host gmail-smtp-in.l.google.com [209.85.225.27] MX=5 host alt1.gmail-smtp-in.l.google.com [173.194.76.27] MX=10 host alt2.gmail-smtp-in.l.google.com [74.125.115.27] MX=20 host alt3.gmail-smtp-in.l.google.com [173.194.67.26] MX=30 host alt4.gmail-smtp-in.l.google.com [173.194.65.26] MX=40 [email protected] router = dnslookup, transport = remote_smtp host gmail-smtp-in.l.google.com [209.85.225.27] MX=5 host alt1.gmail-smtp-in.l.google.com [173.194.76.27] MX=10 host alt2.gmail-smtp-in.l.google.com [74.125.115.27] MX=20 host alt3.gmail-smtp-in.l.google.com [173.194.67.26] MX=30 host alt4.gmail-smtp-in.l.google.com [173.194.65.26] MX=40 search_tidyup called close MYSQL connection: localhost:(/usr/mailsuite/tmp/mysql.sock)/exim/root 

我真的在这里亏本,任何帮助表示赞赏。

事实certificate,MTA无法通过外部DNSparsing器parsingDNSlogging。 我在本地服务器上安装了dnsmasq,并将其作为我的/etc/resolv.conf中的第一个条目,并且exim和postfix都能够发送到远程服务器。

Exim不会以root身份运行。 它使用的默认非根用户标识是作为构build的一部分进行硬编码的。 在你的情况下,它似乎是exim 。 添加一个用户ID exim与组exim ,它应该运行。

编辑:错过了日志上的滚动条。 Exim似乎正在select正确的路由器,DNS查找成功。 但是,没有迹象表明正在build立与远程服务器的连接。 尝试使用telnet到一个或多个IP来查看是否可以连接到SMTP端口。 命令

 telnet 209.85.225.27 25 

应该导致如下所示:

 Trying 209.85.225.27... Connected to 209.85.225.27. Escape character is '^]'. 220 mx.google.com ESMTP el4si7116293icb.3 

从220开始的那一行表示你已经连接到服务器。 如果成功,请键入QUITclosures连接。 如果不成功,则可能是防火墙阻止了传出的SMTP连接。