Sendmail排队邮件,不发送

我有一个Ubuntu服务器与PHP和sendmail。

当我使用PHP通过sendmail发送电子邮件时,邮件永远处于sendmail队列中,永远不会被发送。 即使我强行冲洗,它仍然在队列中。

这可能是什么原因,我该如何解决?

谢谢。

编辑:“cat / var / spool / mqueue / qfn82FuSu3009905”的输出是:

V8 T1251906988 K1251927546 N6 P570369 I8/1/121795 MDeferred: Connection timed out with alt4.gmail-smtp-in.l.google.com. Fwbs $_localhost [127.0.0.1] $rESMTP $sworld0.com ${daemon_flags} ${if_addr}127.0.0.1 S<[email protected]> A<> MDeferred: Connection timed out with alt4.gmail-smtp-in.l.google.com. rRFC822; [email protected] RPFD:<[email protected]> H?P?Return-Path: <g> H??Received: from world0.com (localhost [127.0.0.1]) by world0.com (8.14.3/8.14.3/Debian-6) with ESMTP id n82FuSu3009905 for <[email protected]>; Wed, 2 Sep 2009 08:56:28 -0700 H?x?Full-Name: www-data H??Received: (from www-data@localhost) by world0.com (8.14.3/8.14.3/Submit) id n82FuR5T009904; Wed, 2 Sep 2009 08:56:27 -0700 H??Date: Wed, 2 Sep 2009 08:56:27 -0700 H??Message-Id: <[email protected]> H??To: [email protected] H??Subject: Website feedback form H??MIME=Version: 1.0 H??Content-type: text/html; charset=iso-8859-1 H??From: [email protected] . 

我不知道哪里出了问题。

编辑2:

那么,我可以ping通服务器,但不能通过telnet与它通话,这怎么可能? 我没有运行防火墙。

 root@world0:~# telnet alt4.gmail-smtp-in.l.google.com 25 Trying 72.14.221.114... telnet: Unable to connect to remote host: Connection timed out root@world0:~# ping 72.14.221.114 PING 72.14.221.114 (72.14.221.114) 56(84) bytes of data. 64 bytes from 72.14.221.114: icmp_seq=1 ttl=241 time=167 ms 64 bytes from 72.14.221.114: icmp_seq=2 ttl=241 time=171 ms 64 bytes from 72.14.221.114: icmp_seq=3 ttl=241 time=169 ms 64 bytes from 72.14.221.114: icmp_seq=4 ttl=241 time=222 ms ^C --- 72.14.221.114 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3015ms rtt min/avg/max/mdev = 167.840/182.722/222.589/23.055 ms 

我find了解决scheme。

我的ISP开始阻止端口25,以阻止垃圾邮件。 一个快速的电话打开了端口备份,所有的邮件开始stream动。

谢谢乔的帮助。

要了解更多关于消息处置的信息,请尝试以下操作:

 mailq 

你会看到很多这样的线条:

 n812uLGQ001861 12089700 Mon Aug 31 19:56 <******@*****.org> (Deferred: Connection timed out with c.mx.mail.yahoo.com.) <******@yahoo.com> n82FR6a3019167 22388400 Wed Sep 2 08:27 <******@*****.net> (reply: read error from g.mx.mail.yahoo.com.) <******@yahoo.com> 

其中n82FR6a3019167是消息ID

 ls -al /var/spool/mqueue/*<message ID> 

尝试查看这些文件(它们只是文本文件),特别是名为qn82FR6a3019167的文件 (或者任何您的消息ID号码。 注意:消息ID之前的' q '。您应该能够确定消息的状态,这将有助于确定哪些工作不正常。

 cat /var/spool/mqueue/qn82FR6a3019167 

如果这样做没有帮助,则可能需要查看sendmail.cf中的智能继电器设置。 您的PHP服务器可能需要通过智能中继主机中继邮件。


接下来,我将尝试从PHP服务器到Google邮件服务器的手动SMTP会话 。

 telnet alt4.gmail-smtp-in.l.google.com 25 Trying 209.85.129.114... Connected to alt4.gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP p9si790839fkb.7 helo <yourhostname> 250 mx.google.com at your service mail from:<[email protected]> 250 2.1.0 OK p9si740839fkb.7 rcpt to:<[email protected]> 250 2.1.5 OK p9si740839fkb.7 data 354 Go ahead h2si759562fkh.29 Subject: This is a test Testing! . 250 2.0.0 OK 1251933071 h2si759562fkh.29 quit 221 2.0.0 closing connection h2si759562fkh.29 Connection closed by foreign host. 

这将希望告诉你,如果您的IP地址被阻止,或者如果存在一些SPF(发件人策略框架)问题,或者如果您有DNS名称不匹配,可能会导致您的电子邮件被拒绝或延期。

我想你在你的回复中截断了细节的清单。 您的系统真的应该有一个有效的主机名,该主机名具有反向DNS条目。

另外,请检查您的/ etc / hosts文件以确保您的IP地址在此处正确列出。 在将电子邮件转发到互联网时(至less在我的经验中),主机名不匹配是一个很常见的问题。

就像是:

 # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost xxx.xxx.xxx.xxx yourhostname.yourdomain.com yourhostname 

看看Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com 。 他们告诉您,您的服务器能够parsinggmail.com的MXlogging,但无法连接到远程服务器。 当您从邮件服务器telnet到该主机的端口25时会发生什么? 你应该看到这样的东西(注意我input“quit”):

 crunch:/Users/gerald$ telnet alt4.gmail-smtp-in.l.google.com 25 Trying 72.14.221.114... Connected to alt4.gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP d4si791296fga.25 quit 221 2.0.0 closing connection d4si791296fga.25 Connection closed by foreign host. 

你有没有阻止端口25出站连接的防火墙规则?

首先检查队列中的消息和错误日志(/var/log/mail.err)然后为了强制删除,你可以这样做(即使它真的被卡住了)

 rm -rf /var/spool/mqueue/*