title: Detecting bounced messages by Return-Path header
body: <p>some time ago I saw a question about detecting bounced messages:</p>
  
  <p>I am working on a tool that will be sending bulk messages (not spam :) and I need to add a feature that will detect bounced messages. Is there a standard response associated with bounces? Would it be in the header of the body?
  By Santa, 2011-09-12</p>
  
  <hr>
  
  <p>You can not rely on either the headers or the body of the bounced message to be able to reliably identify the original recipient, especially if you want to automate the process. Even if you add your own custom headers, it's likely that the bouncing server will strip them when it sends notification back to you .............................</p>
  
  <p>The only piece of information that will remain completely untouched in a bounce is the return path email address -- the address that your server advertises it wants bounces sent to. Thus, the only way to automate truly accurate bounce catching is to encode the recipient directly into the return path address itself.
  This would typically be done by overriding your server's default return path address for each outgoing message, using a unique value per recipient, like bounce-XXXXX@yourdomain.com, where XXXXX is some encoded and/or obfuscated representation of the recipient's email address or some other internal identifier. This technique requires the use of an email server which can support this type of wild card catch-all address so that you don't have to set up a new bounce account for each email address you're sending to. Assuming that, you simply configure the server to dump all such bounce-* emails to your script, which needs only to decode the XXXXX in order to determine who the original recipient was.
  answered Sep 12 '11 Alex Howansky</p>
  
  <p>The above seems an excellent solution.
  <strong>Now my question is:</strong></p>
  
  <p>How to configure a Postfix (or any other) mail server to dump each and every bounced email from the bounce@yourdomain.com account to a script which will parse and retrieve the identity of the original recipient ? Has the script to be saved a directory in the mail server and the dumped message in the same directory ?</p>
  
  <p>Will a third party email service provider allows you to configure the email account for dumping messages, and install the script in the server? </p>
  
  <p>Sing</p>