我正在运行Ubuntu 10.04 LTS服务器和Amazon EC2。 刚刚启动了社区,安装了apache2,php5,sendmail …这就是它。
没有改变任何configuration。 昨天晚上,我发送了一个通讯给大约2000名收件人。
mail.log显示消息被接受发送,如下所示:
Jan 27 16:40:42 ip-10-48-213-66 sendmail[24725]: p0RGefNE024725: [email protected], ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=67364, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p0RGefKv024726 Message accepted for delivery)
但似乎这样反弹回来:
Jan 27 16:40:42 ip-10-48-213-66 sm-mta[24728]: p0RGefKv024726: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=157483, relay=smtp.zoovienna.at. [83.64.127.201], dsn=4.0.0, stat=Deferred: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found
或这个
Jan 27 20:13:39 ip-10-48-213-66 sm-mta[10058]: p0RH5QCC032505: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=03:08:13, xdelay=00:00:01, mailer=esmtp, pri=1777483, relay=mx00.kundenserver.de. [212.227.15.150], dsn=4.0.0, stat=Deferred: 421 invalid sender domain 'ip-10-48-213-66.eu-west-1.compute.internal' (misconfigured dns?)
或这个
Jan 27 20:13:39 ip-10-48-213-66 sm-mta[10058]: p0RH2CUw031458: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=03:11:27, xdelay=00:00:00, mailer=esmtp, pri=1777483, relay=mxzhb.bluewin.ch. [195.186.18.144], dsn=4.0.0, stat=Deferred: 451 MAIL FROM: <[email protected]> Unable to verify MX-Record for domain ip-10-48-213-66.eu-west-1.compute.internal
总是多次,仍然在运行…
我注意到/etc/mail/trusted-users是空的。 但是,由于电子邮件似乎出去应该没问题。
/etc/mail/local-host-names看起来像
localhost ip-10-48-213-66.eu-west-1.compute.internal
现在,如果我使用下面的PHP命令发送邮件:
var_dump(mail('[email protected]','subject!','body!','From: [email protected]','-f [email protected]'));
我收到以下邮件:
Delivered-To: [email protected] Received: by 10.42.219.8 with SMTP id hs8cs55591icb; Fri, 28 Jan 2011 03:28:51 -0800 (PST) Received: by 10.213.35.209 with SMTP id q17mr4059475ebd.53.1296214129940; Fri, 28 Jan 2011 03:28:49 -0800 (PST) Return-Path: <[email protected]> Received: from ip-10-48-213-66.eu-west-1.compute.internal (flimmit.com [79.125.4.119]) by mx.google.com with ESMTPS id u13si41731903eeh.3.2011.01.28.03.28.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 Jan 2011 03:28:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of [email protected] designates 79.125.4.119 as permitted sender) client-ip=79.125.4.119; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of [email protected] designates 79.125.4.119 as permitted sender) [email protected] Received: from ip-10-48-213-66.eu-west-1.compute.internal (localhost [127.0.0.1]) by ip-10-48-213-66.eu-west-1.compute.internal (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id p0SBRYQF000694 for <[email protected]>; Fri, 28 Jan 2011 11:27:34 GMT Received: (from www-data@localhost) by ip-10-48-213-66.eu-west-1.compute.internal (8.14.3/8.14.3/Submit) id p0SBRYCv000693; Fri, 28 Jan 2011 11:27:34 GMT Date: Fri, 28 Jan 2011 11:27:34 GMT Message-Id: <201101281127.p0SBRYCv000693@ip-10-48-213-66.eu-west-1.compute.internal> X-Authentication-Warning: ip-10-48-213-66.eu-west-1.compute.internal: www-data set sender to [email protected] using -f To: [email protected] Subject: subject! X-PHP-Originating-Script: 1000:test.php From: [email protected] body!
我也注意到,发送邮件需要相当长的时间,如果解决地址有问题,我知道这是一个问题。
我的sendmailpath没有在php.ini中configuration,但php信息显示以下应该是正确的: /usr/sbin/sendmail -t -i
这是通过电子邮件从通讯工具(phplist)通过,并没有显示xauthentication警告标题。
我可以以某种方式解决这个问题,或者有什么办法来确定谁收到了邮件,谁没有,所以我可以重新发送?
任何帮助是appriciated。
更新:
我只注意到邮件工具可能没有设置-f参数。 我解决了这个问题 现在,本地地址仍然显示出来,但在像golem这样的专业列表的其他电子邮件中也是如此。
所以在上面我用-f参数生成的电子邮件中。 现在好吗还是有问题?
您的sendmailconfiguration错误。 它使用内部EC2域名ip-10-48-213-66.eu-west-1.compute.internal作为发件人域,并且由于无法查找和检查,所以电子邮件被拒绝。 你需要在那里放置一个实际的互联网域名,它对你发送的IP地址进行反向DNS查找 – 你必须向亚马逊申请从EC2发送电子邮件的权限,以便让他们configuration为你反向DNS。
从EC2服务器发送电子邮件在任何情况下都会非常棘手,因为很多EC2 IP地址都在黑名单中。 亚马逊刚刚发布的新简单电子邮件服务可能会更好。
一个很好的方法来检查谁收到你的电子邮件是通过使用Return-Path头为每个收件人生成一个唯一的退回地址,这样你就可以parsing你的退回邮箱,并一个接一个地将邮件退回给你。
我发现你使用的是EC2,但是我们不build议直接从EC2运行你的邮件服务,因为可交付率非常低和可变(正是你的问题),我也遇到了EC2的这个问题,外部SMTP提供商为了得到所有的传递能力和弹性整理出来,它足够便宜,足以certificate成本在这么低的成本。
我为此使用AuthSMTP( http://www.authsmtp.com/ ),它们便宜且非常可靠。
我这样做的时候解决了这个问题:
# vi /etc/mail/sendmail.mc MASQUERADE_AS(domain.com)dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl MASQUERADE_DOMAIN(domain.com)dnl # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf # yum install sendmail-cf # /etc/init.d/sendmail restart