Detectar mensajes rebotados por el encabezado Return-Path

some time ago I saw a question about detecting bounced messages:

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


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 .............................

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

The above seems an excellent solution. Ahora mi pregunta es:

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 ?

Will a third party email service provider allows you to configure the email account for dumping messages, and install the script in the server?

Cantar

preguntado el 01 de febrero de 12 a las 22:02

1 Respuestas

The pertinent standard is called VERP, por cierto.

Quiere decir bounce+token@yourdomain.com, not just plain bounce@yourdomain.com. The token is what makes it unique!

Postfix will already accept mail for a+something@example.net given a valid address a@example.net as long as you configure the recipient_delimiter in main.cf:

recipient_delimiter = +

There are a few different ways to configure Postfix so that it will deliver the mail to your script AND tell you what the token was. Try this:

  1. Create the address bounce@yourdomain.com the same way you create aliases normally in that domain: e.g. a regular alias or a virtual mailbox

  2. Create a custom delivery transport in master.cf. ${extension} means that the script will receive whatever came after the + as its first argument, and <username> should the the local uid under which the script should run.

    bounce   unix  -       n       n       -       -       pipe
      flags=R user=<username> argv=/script/which/receives/bounces ${extension}
    
  3. Create a transport map if you don't already have one:

    transport_maps = hash:/etc/postfix/transport
    
  4. Agregue la siguiente línea en /etc/postfix/transport dirigir bounce@yourdomain.com to the new transport you created in master.cf:

    bounce@yourdomain.com    bounce:
    
  5. Rebuild the transport map:

    postmap /etc/postfix/transport
    

Respondido 02 Feb 12, 03:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.