I am using imap_xxx to access emails for my website, we need to discard all emails which are system non-human generated like out of office, autoreply, mail-bounce, error etc. Need to write a code for the same in PHP.
Code pointer would be appreciated.
Thanks
A few regexes you could apply to the envelope sender ("Return-Path" header) to check for automated senders:
"^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@",
headers that indicate automated sender if they exist:
"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'
headers that indicate an automated sender if they match a certain regex:
'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)',