简体   繁体   English

Sendmail 问题:已成功发送但从未到达

[英]Sendmail issue: successfully sent but never arrives

I'm trying to send mail via the PHP mail() function which as far as I have understood uses sendmail to deliver the goods.我正在尝试通过 PHP mail() function 发送邮件,据我所知,它使用 sendmail 来发送邮件。 Now my problem is that mail() returns true but there is not even a trace of the mail in my mailbox (yea i checked spam too).现在我的问题是 mail() 返回 true 但我的邮箱中甚至没有邮件的踪迹(是的,我也检查了垃圾邮件)。

So i tried to send some mail manually from the terminal but the problem persists.所以我尝试从终端手动发送一些邮件,但问题仍然存在。 sendmail does not give me an error, except from a unable to determine domain error which i fixed by adding the domain for my dev-machine to /etc/hosts and related it to 127.0.0.1. sendmail 不会给我一个错误,除了无法确定域错误,我通过将我的开发机器的域添加到 /etc/hosts 并将其与 127.0.0.1 相关联来修复该错误。

andreas@Andreas-PC-Ubuntu:~$ sendmail xxxxxxx@xxxxxxx.com
Test
.
andreas@Andreas-PC-Ubuntu:~$

As well as giving no error, sendmail logs that the mail was sent successfully in /var/log/mail.log:除了没有给出任何错误,sendmail 还会在 /var/log/mail.log 中记录邮件已成功发送:

Apr  7 01:16:21 Andreas-PC-Ubuntu sendmail[11759]: q36NGIfD011759: from=andreas, size=5, class=0, nrcpts=1, msgid=<201204062316.q36NGIfD011759@home.hagenz.com>, relay=andreas@localhost
Apr  7 01:16:21 Andreas-PC-Ubuntu sm-mta[11760]: q36NGL1J011760: from=<andreas@home.hagenz.com>, size=299, class=0, nrcpts=1, msgid=<201204062316.q36NGIfD011759@home.hagenz.com>, proto=ESMTP, daemon=MTA-v4, relay=ip6-localhost [127.0.0.1]
Apr  7 01:16:21 Andreas-PC-Ubuntu sendmail[11759]: q36NGIfD011759: to=xxxxxxx@xxxxxxx.com, ctladdr=andreas (1000/1000), delay=00:00:03, xdelay=00:00:00, mailer=relay, pri=30005, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q36NGL1J011760 Message accepted for delivery)

So yea, any suggestions?是的,有什么建议吗?

Are you sure the recipient SMTP server isn't dropping (or at least greylisting) your mail?您确定收件人 SMTP 服务器没有丢弃(或至少将其列入灰名单)您的邮件吗? It's very common for mail servers to treat messages not coming from a recognized MX server as being spammy.邮件服务器将不是来自公认的 MX 服务器的邮件视为垃圾邮件是很常见的。

Is sendmail configured to use an SMTP relay/smarthost? sendmail 是否配置为使用 SMTP 中继/智能主机? If not, what happens if you configure it to use your ISP's, employer's, or other hosting provider's server?如果不是,如果您将其配置为使用您的 ISP、雇主或其他托管服务提供商的服务器,会发生什么情况?

have you set up the configuration in your php.ini file?您是否在 php.ini 文件中设置了配置?

When i setup php on my own server (I was running IIS on server 2003, with Exchange for emails), I had to edit the php.ini file to configure the Mail function.当我在自己的服务器上设置 php 时(我在服务器 2003 上运行 IIS,使用 Exchange 发送电子邮件),我必须编辑 php.ini 文件来配置邮件 function。

Just had to uncomment andspecify my mail server for the SMTP part.只需取消注释并为SMTP部分指定我的邮件服务器。

Edit编辑

[mail function]; For Win32 only. ; http://php.net/smtp SMTP = #mymailserver#; http://php.net/smtp-port smtp_port = 25

You will probably have to do the same, or similar, depending on your web server environment您可能必须执行相同或类似的操作,具体取决于您的 web 服务器环境

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM