在 php 中检索退回邮件?

2021-12-29 00:00:00 php phpmailer zend-framework

我正在使用 swift mailer ,它只为我提供失败邮件的选项,即表示邮件是否投递到外发邮件服务器(发送过程后不报告).所以我想办法告诉我是否有退回邮件.我找到了 zend 和 phpmailer BHM,phpmailer 有一段时间没有更新(2009 年),那么 zend 最佳选择是否可以帮助我做到这一点,或者我可以通过一些 php 编码来做到这一点?谢谢

I am using swift mailer , which only provide me opition of failure mail, that is, indicate whether the mail delivered to outgoing mail server (not report after sending process). So i am finding any way to tell me whether there is bounce mail. I find zend and phpmailer BHM, the phpmailer has not updated for a while (2009) , so would zend the best choice can help me doing this or i can do it by some coding in php? Thank you

参考:

1.Zendhttp://framework.zend.com/manual/en/

2.phpmailer BMHhttp://phpmailer.worxware.com/index.php?pg=bmh

2.phpmailer BMH http://phpmailer.worxware.com/index.php?pg=bmh

推荐答案

要处理退回的邮件,Zend Framework 仅在您将所有退回的邮件发送到某个真实邮箱的某个位置时才有帮助,然后您可以使用 Zend_Mail 连接到邮箱,并阅读所有邮件并查找弹跳.否则,在我看来,它没有任何东西可以让您更轻松地处理在 PHP 或其他库中无法做到的反弹.

To process bounced messages, Zend Framework would only be helpful if you had all bounced messages go to a real mailbox somewhere, and then you could use Zend_Mail to connect to the mailboxes, and read all of the messages and look for bounces. Otherwise, in my opinion it doesn't have anything that would make it any easier to process bounces that you couldn't do in PHP or other libraries.

以上当然是一个很好的解决方案.

The above is certainly a good solution to this.

或者,您可以将特定电子邮件地址的所有传入邮件通过管道传输到 PHP 脚本(或者它不必是 PHP).此脚本将能够读取 stdin 以获取电子邮件消息的内容.然后,您可以使用诸如 mailparse 之类的内容将消息解析为 mime 部分,以使其更易于处理标题和消息.不需要使用这样的解析器,但它会使处理退回电子邮件的任务更容易.要执行类似操作,请搜索 pipe mail to php或类似.

Alternatively, you can have all incoming mail for a particular email address piped to a PHP script (or it doesn't have to be PHP). This script would be able to read stdin to get the contents of the email message. You could then use something like mailparse to parse the message into mime parts to make it easier to process the headers and messages. Using such a parser is not required, however it would make the task of processing bounced emails easier. To do something like that, search for pipe mail to php or similar.

这个答案还提供了一些很好的信息,说明邮件服务器将使用哪些地址将退回邮件发送回.

This answer also provides some good information on which address mail servers will use to send bounces back to.

相关文章