我使用imap_xxx访问我网站的电子邮件,我们需要丢弃所有系统非人类生成的电子邮件,如不在办公室,自动回复,邮件反弹,错误等。需要编写相同的代码PHP。
代码指针将不胜感激。
由于
答案 0 :(得分:3)
您可以将几个正则表达式应用于信封发件人(“Return-Path”标题)以检查自动发件人:
"^owner-",
"^request-",
"-request@",
"bounce.*@",
"-confirm@",
"-errors@",
"^no[\-]?reply",
"^donotreply",
"^postmaster@",
"^mailer[-_]daemon@",
"^mailer@",
"^listserv@",
"^majordom[o]?@",
"^mailman@",
"^nobody@",
"^bounce",
"^www(-data)?@",
"^mdaemon@",
"^root@",
"^webmaster@",
"^news(letter)?@",
"^administrator@", #role accounts, maybe you want these
"^support@",
标头表示自动发件人是否存在:
"list-help",
"list-unsubscribe",
"list-subscribe",
"list-owner",
"list-post",
"list-archive",
"list-id",
"mailing-List",
"x-facebook-notify",
"x-mailing-list",
'x-cron-env',
'x-autoresponse',
'x-eBay-mailtracker'
标头表示如果自动发件人与某个正则表达式匹配,则表示自动发件人:
'x-spam-flag':'yes',
'x-spam-status':'yes',
'precedence':'(bulk|list|junk)',
'x-precedence':'(bulk|list|junk)',
'x-barracuda-spam-status':'yes',
'x-dspam-result':'(spam|bl[ao]cklisted)',
'X-Mailer':'^Mail$',
'auto-submitted':'auto-replied',
'X-Auto-Response-Suppress':'(AutoReply|OOF)',