Detecting bounced messages by Return-Path header

核能气质少年 提交于 2019-11-29 20:42:15

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
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!