We have an application that sends newsletter in email format. We would like to have a bounceback report. I am sure there has to be tools (free or not) that do this already, look into a specific email that was sent and wait for bounceback and then drops a report somewhere.
The use case is simple. We send a newsletter to a distribution list with the subject x, and from addres [email protected] then we want to see how many emails came back per code rejection and other groupings.
Any help will be appreciated.
You should use VERP. This is a method where you embed the recipient email address in the sender (envelope). This is especially useful when forwarding is involved (on the remote user part) as parsing the bounced mail to get the real original recipient is impossible in that case.
You did not said which mailer you use, but here is the documentation for postfix. Minimal modification is required in you program if you choose this path.
Typically the way mass list sender software works is to generate a unique ID, either for the destination user (in the case of a discussion list) or for the specific mailing + the destination user (which might be more suitable for a newletter) and use that for the return address. You store the unique IDs in a database for use when parsing bounces.
You use some kind of prefix-matching in your mail server to route [email protected] to a specific mailbox for post-processing. Strip the unique ID out of the destination address of the bounce, then look it up in your database to see who the original recipient was.
This gets around the potential expansion / munging of recipient addresses that may happen when poorly implemented MTAs get ahold of your original message.
For extra credit, keep a count of how often a given email address has bounced so that you stop sending to boxes which have gone away.
You could use phplist which has advanced Bounce handling. It let's you teach phplist to distinguish between permanent and temporary message-delivery errors. You can define automated actions on receipt of bounce messages according to matches with your regular expressions.
phplist Documentation : PhpListConfigBounces
Another way is to set a message header:
And you could change "bounces" to an unique id to know exactly which address that bounced.
We have considered using Atomic Mail Tracker ( http://www.massmailsoftware.com/tracker/ ) but haven't made any decisions. It looks like it has all of the features we want, so it might help you, too.