PHP中的退回邮件处理 - 是否有任何最新的解决方案?[已关闭]

2022-08-30 18:20:11

我需要使用PHP进行一些退回邮件处理。浏览电子邮件是没有问题的,但是将资源投入到编写我们自己的库来解析被退回的电子邮件是非常不可取的。

我发现有3个PHP解决方案应该用于处理退回邮件,但从我所看到的来看,它们都已经过时了,不再维护。(PHPList, PHPMailer-BMH, Bounce Handler @ PHPClasses.org)

有谁知道一套处理退回邮件的最新规则?我不一定需要任何处理逻辑,即使只是一个最新的规则集也会令人满意。

感谢您的任何帮助。


答案 1

反弹处理并非易事,因为您需要处理许多不同的服务器和响应。这包括那些由于您的电子邮件/主机/IP 已被列入黑名单/垃圾邮件评分而被错误配置和退回的服务器。而且由于“外出”自动回复而出现大量反弹。

我知道的一个简单的解决方案是将自己的标头放入消息中,以标识接收方地址和具体发送(令牌)。当它反弹时,可以基于此验证反弹。

另一种解决方案是将其他信息编码到发件人地址中,并相应地解析它以进行退回。为此,您需要了解电子邮件的工作原理,如果您需要退回邮件,这通常很有用。

关于SO有一些很好的答案(但我还没有找到这个答案),它详细介绍了这个主题的许多细节。如果我找到它,我会添加它。

一般的观点是,我不知道许多基于PHP的工具来处理退回邮件,我知道PHPList(用于邮件列表处理的PHP组件)在他们的存储库中有一些东西:

编辑:具有非常翔实答案的相关问题是:

编辑:它不多,只是一些链接:

我想知道为什么电子邮件退回没有标准,使您可以轻松识别退回邮件和退回原因 - 或者有吗?(像RFC一样)

RFC3834 - 对电子邮件的自动响应建议,由 RFC5436 Sieve 通知机制:mailto 更新

RFC5321 简单邮件传输协议中也部分讨论了退回邮件,该协议清楚地给出了 MTA 必须在无法传递邮件时进行报告的原因。

主要问题是无法在SMTP中验证退回邮件地址(发件人),因此发送退回邮件会带来问题,即它可能发送给错误的人(Backscatter Spam)。

因此,可靠的邮件程序不仅可以检查退回邮件,还可以使用SMTP进行更多操作以获得一定的质量水平,请参阅:

未交付报告的整个维基百科页面对于图片的第一次查看可能很有趣。


答案 2

以下是我以前做过一次的事情。它可以持续捕获至少70%以上的退回邮件。

在发送的电子邮件中,放入一个自定义标头(如“x-email-check-id”),以便为发送的每封电子邮件提供唯一的标识符(可能创建一个GUID并将其存储在每个电子邮件的数据库中)

在服务器端,编写一个 cron 作业以定期从退回邮件地址下载电子邮件,并在回复邮件中查找此标头。这样,您就可以将退回邮件与发送的电子邮件进行匹配。这样,您可以确定此电子邮件已从您的发送中退回,并且不是垃圾邮件。

之后,在电子邮件内容中搜索特定关键字以确定退回邮件的原因。此关键字列表应经常更新,因为较新的电子邮件服务器返回不同的文本。但这是我使用的列表。

$Email__Full[] = 'databytes limit';
$Email__Full[] = 'exceeded dropfile size';
$Email__Full[] = 'exceeded email quota';
$Email__Full[] = 'exceeded storage';
$Email__Full[] = 'exceeding receiving limits';
$Email__Full[] = 'exceeds the maximum size';
$Email__Full[] = 'folder is full';
$Email__Full[] = 'mail system full';
$Email__Full[] = 'mailbox exceeds allowed size';
$Email__Full[] = 'mailbox full';
$Email__Full[] = 'mailbox has exceeded the limit';
$Email__Full[] = 'mailbox is full';
$Email__Full[] = 'mail box full';
$Email__Full[] = 'out of disk space';
$Email__Full[] = 'out of diskspace';
$Email__Full[] = 'over disk quota';
$Email__Full[] = 'over quota';
$Email__Full[] = 'over the allowed quota';
$Email__Full[] = 'problem with the recipient\'s mailbox';
$Email__Full[] = 'quota exceeded';
$Email__Full[] = 'quota violation';
$Email__Full[] = 'space has been used up';
$Email__Full[] = 'space not enough';
$Email__Full[] = 'status: 5.2.1';
$Email__Full[] = 'status: 5.2.2';
$Email__Full[] = 'status: 5.2.3';
$Email__Full[] = 'status: 5.3.3';

$Email__NotExist[] = '/var/mail/nobody';
$Email__NotExist[] = '550 5.1.1';
$Email__NotExist[] = 'account expired';
$Email__NotExist[] = 'account inactive';
$Email__NotExist[] = 'account suspended';
$Email__NotExist[] = 'address is administratively disabled';
$Email__NotExist[] = 'address is not recognized';
$Email__NotExist[] = 'address is rejected';
$Email__NotExist[] = 'address not recognized';
$Email__NotExist[] = 'address rejected';
$Email__NotExist[] = 'bad destination email address';
$Email__NotExist[] = 'cname lookup failed';
$Email__NotExist[] = 'connection refused';
$Email__NotExist[] = 'couldn\'t find any host';
$Email__NotExist[] = 'could not be found';
$Email__NotExist[] = 'deactivated mailbox';
$Email__NotExist[] = 'delivery time expired';
$Email__NotExist[] = 'destination server not responding';
$Email__NotExist[] = 'disabled or discontinued';
$Email__NotExist[] = 'does not exist';
$Email__NotExist[] = 'does not like recipient';
$Email__NotExist[] = 'doesn\'t have a yahoo.com account';
$Email__NotExist[] = 'doesn\'t have a yahoo.com.sg account';
$Email__NotExist[] = 'domain is for sale';
$Email__NotExist[] = 'find a mail exchanger';
$Email__NotExist[] = 'find any host named';
$Email__NotExist[] = 'following address(es) failed';
$Email__NotExist[] = 'host unknown';
$Email__NotExist[] = 'i couldn\'t find any host by that name';
$Email__NotExist[] = 'illegal user';
$Email__NotExist[] = 'in the queue too long';
$Email__NotExist[] = 'inactive recipient';
$Email__NotExist[] = 'inactive user';
$Email__NotExist[] = 'incorrectly addressed';
$Email__NotExist[] = 'invalid recipient';
$Email__NotExist[] = 'invalid user';
$Email__NotExist[] = 'isn\'t in my control/locals file';
$Email__NotExist[] = 'mailbox not available';
$Email__NotExist[] = 'mailbox not found';
$Email__NotExist[] = 'mailbox unavailable';
$Email__NotExist[] = 'mail is looping';
$Email__NotExist[] = 'message is looping';
$Email__NotExist[] = 'name is not recognized';
$Email__NotExist[] = 'name not found';
$Email__NotExist[] = 'name not recognized';
$Email__NotExist[] = 'no local mailbox';
$Email__NotExist[] = 'no longer accepts mail';
$Email__NotExist[] = 'no longer an employee';
$Email__NotExist[] = 'no longer on server';
$Email__NotExist[] = 'no longer valid';
$Email__NotExist[] = 'no mailbox';
$Email__NotExist[] = 'no route found to domain';
$Email__NotExist[] = 'no such user';
$Email__NotExist[] = 'none of the mail servers for the destination domain has so far responded';
$Email__NotExist[] = 'no valid host';
$Email__NotExist[] = 'no valid recipients';
$Email__NotExist[] = 'not a valid mailbox';
$Email__NotExist[] = 'not listed';
$Email__NotExist[] = 'not listed in domino';
$Email__NotExist[] = 'possible mail loop';
$Email__NotExist[] = 'recipient cannot be verified';
$Email__NotExist[] = 'recipient unknown';
$Email__NotExist[] = 'recipients are invalid';
$Email__NotExist[] = 'recipnotfound';
$Email__NotExist[] = 'relaying denied';
$Email__NotExist[] = 'several matches found in domino';
$Email__NotExist[] = 'status: 5.1.1';
$Email__NotExist[] = 'status: 5.1.3';
$Email__NotExist[] = 'status: 5.1.4';
$Email__NotExist[] = 'status: 5.1.6';
$Email__NotExist[] = 'status: 5.1.7';
$Email__NotExist[] = 'this user doesn\'t have a yahoo';
$Email__NotExist[] = 'too many hops';
$Email__NotExist[] = 'unable to deliver';
$Email__NotExist[] = 'unable to relay';
$Email__NotExist[] = 'unknown address';
$Email__NotExist[] = 'unknown recipient';
$Email__NotExist[] = 'unknown user';
$Email__NotExist[] = 'unrouteable address';
$Email__NotExist[] = 'user doesn\'t have';
$Email__NotExist[] = 'user unknown';
$Email__NotExist[] = 'x-notes; 550 5.1.1';
$Email__NotExist[] = 'x-notes; recipient\'s domino directory';
$Email__NotExist[] = '$B%G%#%l%/%H%j$K$O8+$D$+$j$^$;$s!#'; //* Returned from japanese domino . Somehow means directory is not found.

$Email__Banned[] = '_spam_';
$Email__Banned[] = '550 5.7.1';
$Email__Banned[] = '550 access denied';
$Email__Banned[] = '550 no thanks';
$Email__Banned[] = '550 spam';
$Email__Banned[] = '554 5.7.0';
$Email__Banned[] = '554 5.7.1';
$Email__Banned[] = '554 denied';
$Email__Banned[] = '554 message does not conform to standards';
$Email__Banned[] = '554 message refused';
$Email__Banned[] = '571 message Refused';
$Email__Banned[] = 'activated my anti-spam features';
$Email__Banned[] = 'administrative prohibition';
$Email__Banned[] = 'appears to contain uce/spam';
$Email__Banned[] = 'appears to be spam';
$Email__Banned[] = 'appears to be unsolicited';
$Email__Banned[] = 'banned for spamming';
$Email__Banned[] = 'blackholed by uribl.com';
$Email__Banned[] = 'blacklisted by surbl';
$Email__Banned[] = 'blocked by filter';
$Email__Banned[] = 'blocked by kbas system';
$Email__Banned[] = 'blocked by our content filter';
$Email__Banned[] = 'blocked by spamsssassin';
$Email__Banned[] = 'blocked by the recipient';
$Email__Banned[] = 'blocked by user\'s personal blacklist';
$Email__Banned[] = 'blocked due to spam like qualities';
$Email__Banned[] = 'blocked using spam pattern';
$Email__Banned[] = 'blocked using uceprotect';
$Email__Banned[] = 'body part contains disallowed string';
$Email__Banned[] = 'classified as **spam**';
$Email__Banned[] = 'content blacklist';
$Email__Banned[] = 'content filter rejected the message';
$Email__Banned[] = 'consider the message to be spam';
$Email__Banned[] = 'considered spam';
$Email__Banned[] = 'contains spam';
$Email__Banned[] = 'content filter rejection';
$Email__Banned[] = 'content rejected';
$Email__Banned[] = 'denied by policy';
$Email__Banned[] = 'detected your message as spam';
$Email__Banned[] = 'does not accept UCE';
$Email__Banned[] = 'domain is banned';
$Email__Banned[] = 'email abuse detected';
$Email__Banned[] = 'error 553';
$Email__Banned[] = 'help_spam_16.htm';
$Email__Banned[] = 'high on spam scale';
$Email__Banned[] = 'http://www.google.com/mail/help/bulk_mail.html';
$Email__Banned[] = 'http://www.surbl.org/lists.html';
$Email__Banned[] = 'identified as spam';
$Email__Banned[] = 'identified your message as spam';
$Email__Banned[] = 'listed in multi.surbl.org';
$Email__Banned[] = 'looks like spam';
$Email__Banned[] = 'mail rejected by windows live hotmail for policy reasons';
$Email__Banned[] = 'message bounced by administrator';
$Email__Banned[] = 'message content rejected, ube';
$Email__Banned[] = 'message contains a virus or other harmful content';
$Email__Banned[] = 'message has too high spam probability';
$Email__Banned[] = 'message is blacklisted';
$Email__Banned[] = 'message refused';
$Email__Banned[] = 'no spam here';
$Email__Banned[] = 'not accepted here';
$Email__Banned[] = 'not in the whitelist';
$Email__Banned[] = 'not rfc compliant';
$Email__Banned[] = 'permanently rejected message';
$Email__Banned[] = 'policy violation';
$Email__Banned[] = 'refused mail service';
$Email__Banned[] = 'reject spam mail';
$Email__Banned[] = 'reject the mail';
$Email__Banned[] = 'rejected by filter';
$Email__Banned[] = 'rejected as spam';
$Email__Banned[] = 'rejected by 35 antiSpam system';
$Email__Banned[] = 'rejected by antispam system';
$Email__Banned[] = 'rejected by cloudmark anti-spam';
$Email__Banned[] = 'rejected by our Spam Filter';
$Email__Banned[] = 'rejected by spam filtering';
$Email__Banned[] = 'rejected by surbl';
$Email__Banned[] = 'rejected by the anti-spam system';
$Email__Banned[] = 'rejected due to security policies';
$Email__Banned[] = 'rejected for policy reasons';
$Email__Banned[] = 'rejected for spam';
$Email__Banned[] = 'requires that you verify';
$Email__Banned[] = 'scored as spam';
$Email__Banned[] = 'sender address verification';
$Email__Banned[] = 'sender was rejected';
$Email__Banned[] = 'spam detected by spamassassin';
$Email__Banned[] = 'spam filter pattern';
$Email__Banned[] = 'spam-like characteristics';
$Email__Banned[] = 'spam mail detected';
$Email__Banned[] = 'spam mail refused';
$Email__Banned[] = 'spam message was blocked';
$Email__Banned[] = 'spam rejected';
$Email__Banned[] = 'spam score too high';
$Email__Banned[] = 'status: 5.7.1';
$Email__Banned[] = 'support.proofpoint.com';
$Email__Banned[] = 'suspected spam';
$Email__Banned[] = 'suspicious url in message body';
$Email__Banned[] = 'temporarily deferred';
$Email__Banned[] = 'transaction failed';
$Email__Banned[] = 'unacceptable content';
$Email__Banned[] = 'unacceptable mail content';
$Email__Banned[] = 'unsolicited bulk e-mail';
$Email__Banned[] = 'unsolicited bulk email';
$Email__Banned[] = 'unsolicited email is refused';
$Email__Banned[] = 'validate recipient email';
$Email__Banned[] = 'will be deleted from queue';

$Email__OutOffice[] = 'away for a vacation';
$Email__OutOffice[] = 'away from the office';
$Email__OutOffice[] = 'not in office';
$Email__OutOffice[] = 'on leave';
$Email__OutOffice[] = 'on vacation';
$Email__OutOffice[] = 'out of office';
$Email__OutOffice[] = 'out of the office';

推荐