I need to do some bounced mail processing using PHP. Going through the e-mails is no problem, but investing the resources in writing our own library to parse the bounced e-mails is very undesirable.
There are 3 PHP solutions that I've found that are supposed to be for processing bounced mail, but they are all way out of date and no longer maintained, from what I can see. (PHPList, PHPMailer-BMH, Bounce Handler @ PHPClasses.org)
Does anyone know of an up-to-date set of rules for processing bounced e-mails? I don't necessarily need any handling logic, even just an up-to-date ruleset would be satisfactory.
Thanks for any assistance.
Bounce handling is non-trivial as you need to deal with a lot of different servers and responses. This includes those servers that are misconfigured and bounces because your email/host/IP has been blacklisted / spam-scored. And there are tons of bounces because of "out of office" auto-replies.
A simple solution I know is to put own headers into the message that identify the receiver address and the concrete sending (a token). When it bounces, the bounce can be verified based upon this.
Another solution is to encode additional information into the sender address and parse it accordingly for bounces. For this you need to know about how email works, which generally is useful if you need with bounces.
There is some great answer here on SO (but I haven't found it for this answer) that goes into many details on the topic. If I find it, I'll add it.
The general point is, that I don't know about many PHP based tools to deal with bounces, I know PHPList (PHP components for mailinglist handling) has something in their repository:
Edit: The related question with the very informative answer is:
Edit: It's not much, just some links:
I am wondering why there is no standard in email bouncing that allows you easily to identify bounces and the bounce reason - or is there? (like a RFC)
There is RFC3834 - Recommendations for Automatic Responses to Electronic Mail which go updated by RFC5436 Sieve Notification Mechanism: mailto.
Bouncing is also discussed in part in RFC5321 Simple Mail Transfer Protocol, which clearly gives a reason that an MTA must report back if a message can not be delivered.
The main problem is that the bounce-address (the sender) can not be verified in SMTP, so sending a bounce message bears the problem that it probably goes to a wrong person (Backscatter Spam).
A relyable mailer therefore not only checks for bounces but does more with SMTP to gain a certain level of quality, see:
The whole Wikipedia page of the Non delivery report might be interesting for a first view on the picture.