简体   繁体   English

如何在PHP中获取邮件传递信息

[英]How to get information of mail delivery in PHP

I want to send mail by PHP mail() function. 我想通过PHP mail()函数发送邮件。

Does PHP mail() function return delivery status? PHP mail()函数是否返回传递状态? If not then what is the way to find whether my mail is delivered or not in PHP? 如果不是,那么如何查找我的邮件是否以PHP传递?

Is php mail() function returns delivery status 是php mail()函数返回传递状态

No. There is no common way to tell an E-Mail's actual delivery status. 不可以。没有通用的方法可以告知电子邮件的实际发送状态。 mail() will tell you only whether the E-Mail has been accepted by the outgoing server. mail()仅会告诉您电子邮件是否已被传出服务器接受。

Here is a list of approaches to request a delivery notice, but none of them is waterproof. 是请求交货通知的方法列表,但没有一种是防水的。

If you have trouble with E-Mail arriving, there are several related SO questions, among them this one. 如果您在电子邮件到达方面遇到问题,则有几个相关的SO问题,其中一个是。

It returns a status telling you if it has been successfully delivered to the MTA responsible for actually sending the mail. 它返回一个状态,告诉您是否已成功将其传递给负责实际发送邮件的MTA。 You cannot find out if the mail has been actually delivered to its recipient or not without setting up a special mailbox which receives bounces for your emails. 如果不设置特殊的邮箱来接收邮件的退回邮件,则无法确定邮件是否已实际发送给收件人。 If you decide to create one and set the headers to ensure bounces go there remember that it might take some time before a bounce arrives so right after calling mail() and getting a TRUE return value, you simply have to assume the mail has been sent successfully. 如果您决定创建一个并设置标题以确保退回邮件,请记住,退回邮件可能要花费一些时间,因此在调用mail()并获取TRUE返回值后,您只需假设邮件已发送成功。

You can check /var/log/mail.log , which is the usual location of the sendmail log and only if sendmail has been configured properly in syslog.conf . 您可以检查/var/log/mail.log ,这是sendmail日志的常规位置,并且只有在syslog.conf正确配置了sendmail情况下。

# Log anything of level info or higher.   
* .info;authpriv.none;cron.none
# Log all the mail messages in one place.  
mail.* /var/log/maillog

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

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