Postfix After-Queue内容filter,高级filter不起作用

我按照postfix网站上有关如何设置内容filter的说明 ,我简单的举了一个例子,运行得相当快,但经过长时间的努力,我无法使高级filter工作。

我在示例中设置了一切,smtp在端口25上侦听未经过滤的消息,它具有一个filter设置为将消息传递到调用filter脚本的端口10025,另一个smtp侦听器在端口10026上过滤消息。

在简单的示例中,脚本是消息stream中的最后一个停止,它通过标准input获取消息,并使用sendmail重新执行它。

在先进的例子中,我似乎没有得到消息,似乎不能传递。 我成功地设法返回:'550内容被拒绝'的回应。

我想我的问题是脚本如何接收邮件正文,它是如何返回到邮件队列? 我怎样才能使这一切工作?

main.conf:

content_filter = scan:localhost:10025 

master.conf:

 scan unix - - n - 10 smtp -o smtp_send_xforward_command=yes -o disable_mime_output_conversion=yes -o smtp_generic_maps= localhost:10025 inet nnn - 10 spawn user=filter argv=/home/omri/filter.sh localhost 10026 localhost:10026 inet n - n - 10 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= # Postfix 2.10 and later: specify empty smtpd_relay_restrictions. -o smtpd_relay_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 -o smtpd_authorized_xforward_hosts=127.0.0.0/8 

简单内容filter示例部分 ,您可以使用pipe道(例如stdin)来接收邮件正文。 在先进的 ,你的脚本必须能够充当SMTP服务器和SMTP客户端。

  • 作为SMTP服务器,postfix将使用SMTP将电子邮件发送给脚本。 所以你的脚本必须自己处理SMTP事务。 产卵过程不会对你做,而是作为inetd处理。
  • 作为SMTP客户端,您的脚本也会通过SMTP事务将电子邮件发回到postfix localhost:10026。

从该页面摘录。

第二个例子比较复杂,但是可以提供更好的性能,并且在机器遇到资源问题时不太可能反弹邮件。 此内容filter在localhost端口10025上接收带有SMTP的未过滤邮件 ,并在localhost端口10026上将已过滤的邮件发送回带有SMTP的Postfix

对于不支持SMTP的内容过滤软件,Bennett Todd的SMTP代理实现了一个不错的PERL / SMTP内容过滤框架。 请参阅: http : //bent.latency.net/smtpprox/ 。