Detecting bounced messages by Return-Path header

前端 未结 1 597
北海茫月
北海茫月 2020-12-23 11:12

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 t

相关标签:
1条回答
  • 2020-12-23 11:17

    The pertinent standard is called VERP, by the way.

    You mean 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. Add the following line in /etc/postfix/transport to direct 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
      
    0 讨论(0)
提交回复
热议问题