如何编写一个读取退回电子邮件的PHP脚本? [英] How to write a PHP script that read bounce email?

查看:116
本文介绍了如何编写一个读取退回电子邮件的PHP脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP处理退回电子邮件。我在邮件函数中包含了返回路径,例如:

I am doing a bounce-email handling with PHP. I have include the return path in the mail function, e.g:

mail($to_address, $subject, $message, $headers, "-f".$return_path );
$return_path = "bounce_handle@domain.com";

现在,我的php脚本应该是什么样子(以及应该放在哪里)才能阅读所有退回电子邮件? (可以向我显示一些示例代码吗?)

Now, what should my php script looks like (and where should i put it) in order to read all the bounce emails? (can show me with some sample code?)

推荐答案

您需要配置任何邮件传输代理处理(MTA) bounce_handle@domain.com将邮件发送到PHP脚本,该脚本可以完成您需要执行的任何操作。 MTA是实际处理进入服务器的邮件的工具。有许多不同的MTA,但是大多数MTA具有一些配置,在这些配置中,您基本上可以告诉它将来自特定地址的电子邮件通过管道传递到自定义脚本中。

You'll need to configure whichever mail transport agent handles (MTA) "bounce_handle@domain.com" to send the mail to the PHP script that does whatever magic you need it to do. The MTA is what actually handles mail coming into the server. There are many different MTA's, but most of them have some configuration where you can basically tell it to pipe email coming into a certain address into a custom script.

可以为您的退回处理程序设置邮箱,并让PHP通过POP3读取它。为此,您必须为退回处理程序配置一个实际的电子邮件帐户。然后,使用标准协议将PHP脚本连接到该邮箱。 有关如何完成此操作的信息,请参阅IMAP / POP上的php.net文档。

Alternatively, you could setup a mailbox for your bounce handler and have PHP read it via POP3. For this, you'd have to configure an actual email account for your bounce handler. Then you have your PHP script connect to that mailbox using standard protocols. See the php.net documentation on IMAP/POP for how this is accomplished.

这篇关于如何编写一个读取退回电子邮件的PHP脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆