通过Return-Path标头检测退回的消息 [英] Detecting bounced messages by Return-Path header

查看:241
本文介绍了通过Return-Path标头检测退回的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间我发现有关检测退回邮件的问题:



我正在开发一种将发送大量邮件(不是垃圾邮件)的工具,我需要添加一个将检测退回消息的功能。有弹跳的标准响应吗?它会在身体的头部吗?
由Santa,2011-09-12






您不能依赖于标题或正文反弹的消息能够可靠地识别原始收件人,特别是如果要自动化过程。即使您添加了自己的自定义标头,反弹服务器可能会在将通知发回给您时将其删除......................... ....



唯一的信息将保持完整不变的反弹是返回路径电子邮件地址 - 您的服务器通告的地址,它希望弹跳发送至。因此,自动化真正准确的反弹捕获的唯一方法是将收件人直接编码到返回路径地址本身。
这通常可以通过覆盖每个传出邮件的服务器的默认返回路径地址,使用每个收件人的唯一值,如bounce-XXXXX@yourdomain.com,其中XXXXX是某些编码和/或混淆的表示形式收件人的电子邮件地址或其他内部标识符。这种技术需要使用一个电子邮件服务器,可以支持这种类型的通配卡全部地址,以便您不必为每个要发送的电子邮件地址设置一个新的退回帐户。假设您只需将服务器配置为将所有此类反弹邮件转储到脚本中,这些脚本只需解码XXXXX即可确定原始收件人是谁。
回答9月12日11点Alex Howansky



以上看来是一个很好的解决方案。
现在我的问题是:



如何配置Postfix(或任何其他)邮件服务器来转储每个弹出的邮件从bounce@yourdomain.com帐户到脚本,解析和检索原始收件人的身份?是否将脚本保存在邮件服务器中的目录,并将转储的邮件保存在同一目录中?



第三方电子邮件服务提供商是否允许您配置电子邮件帐户用于转储邮件,并将脚本安装在服务器中?



Sing

解决方案

相关标准称为VERP ,顺便说一句。



你的意思是 bounce +token@yourdomain.com ,不仅仅是简单的 bounce@yourdomain.com 。令牌是什么使其独一无二!



Postfix将已经接受 a+something@example.net 的邮件只要在 main中配置 recipient_delimiter ,即可有效地址 a@example.net 。 cf

  recipient_delimiter = + 

有几种不同的方式来配置Postfix,以便它将邮件传递到你的脚本,并告诉你什么是令牌。尝试这样:


  1. 创建地址 bounce@yourdomain.com 同样的方式,您通常在该域中创建别名:例如常规别名或虚拟邮箱


  2. master.cf 中创建自定义传递传输。 $ {extension} 意味着该脚本将收到 + 作为其第一个参数之后的任何内容,< username> 应该是脚本应该运行的本地uid。

      bounce unix  -  nn  -   -  pipe 
    flags = R user =< username> argv = / script / which / received / bounces $ {extension}


  3. 如果您还没有一个:

      transport_maps = hash:/ etc / postfix / transport 


  4. / etc / postfix / transport 中的以下行添加到直接 bounce@yourdomain.com 到您在 master.cf 中创建的新运输:

      bounce@yourdomain.com bounce:


  5. 重建运输地图:

      postmap / etc / postfix / transport 



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. Now my question is:

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?

Sing

解决方案

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
    

这篇关于通过Return-Path标头检测退回的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆