自动从数据库中删除反弹的电子邮件地址? [英] Automatically remove bounced email addresses from database?

查看:316
本文介绍了自动从数据库中删除反弹的电子邮件地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经从人们已经签署了通讯我们的网站之一,在我们的数据库中的电子邮件地址的大名单。

We have a big list of email addresses in our database from where people have signed up for newsletters for one of our websites.

我们有使用PHP从数据库中抓取电子邮件地址和发送的通讯cron作业。

We have a cron job that uses PHP to grab email address from the database and sends out the newsletters.

当电子邮件被退回,cron作业管理得到一个电子邮件了。

When an email gets bounced back, the cron job admin gets an email about it.

如果我们想要一个脚本来自动从数据库中删除反弹的电子邮件地址,什么是完成它的最佳方式?有什么方法来记录退回的电子邮件,然后有一个脚本,分析日志,然后去除不良的电子邮件地址?还是有办法通过PHP来测试退回的电子邮件地址吗?

If we wanted a script to automatically remove bounced email address from the database, what is the best way to accomplish it? Is there someway to log bounced emails and then have a script parse the log and then remove the bad email addresses? Or is there a way to test for bounced email addresses via PHP?

推荐答案

您想要做的是选择一个通用的反弹的电子邮件地址(例如,bounce@example.com)。你想设置你的标题返回路径,以bounce@example.com。

What you want to do is choose a "universal" bounce email address (say, bounce@example.com). You want to set your header "Return-Path" to "bounce@example.com".

然后,你有一个外部的过程中勾选bounce@example.com收件箱中的邮件。不要使用此电子邮件帐户为别的,但反弹。

Then, you have an external process check the "bounce@example.com" inbox for messages. Don't use this email account for anything else but bounces.

您会收到反弹,度假的消息,电子邮件和其他类型的这个收件箱。你只需要的列车的解析器寻找在电子邮件中的某些模式。你的模式列表不会COM prehensive在第一,但你需要手动看看这个收件箱,从时间到时间,让您可以进一步的列车的解析器。

You will receive bounces, vacation messages, and other types of emails to this inbox. You just need to train your parser to look for certain patterns in the email. Your list of patterns won't be comprehensive at first, but you need to manually look at this inbox from time-to-time so you can further train your parser.

您的解析器可以简单寻找简单子,甚至经常前pressions。在大多数情况下,常规的前pressions是没有必要的。

Your parser can be simple and look for simple substrings or even regular expressions. In most cases, regular expressions aren't necessary.

这篇关于自动从数据库中删除反弹的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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