How to handle mail delivery errors with PHP

房东的猫 提交于 2019-12-04 21:26:11

When reading the "bounced inbox", you can use a class like this to actually parse the mail and see what status was returned (e.g. permanent or temporary error):

http://www.phpclasses.org/browse/package/2691.html

To really parse a mail accurately will give you a hard time, as not all mailservers are alike and some will send you a "mailbox full"-error marked with a "permanent" flag while others may tell you that the error "user doesn't exist" is "temporary".

I tried a solution for this once and ended up setting up my own parser connected to a huge database containing possible server replies (and their "real" meaning :).

You can use a reply to address while sending. So bouned emails will be sent to this id. You can also create another PHP script which will read this "reply to" email inbox and get the id from it. You can then remove this id from the list you have.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!