如何让content_filter只为我的域名工作

我有一个简单的content_filter,并将其成功附加到Postfix。 但是,任何来自Postfix的电子邮件都会调用这个filter。 不过,我只希望在电子邮件进入我的服务器时(如:name @ mydomain)调用此filter。 对于邮件通过我的服务器中继到其他服务器(到:name @ otherdomain),我不希望我的filter被称为。

提前致谢。

main.cf中全局使用content_filter ,可以使用具有FILTER特性的访问(5)表规则打开内容过滤。 请参阅这里了解更多信息。

在您的smtpd_*_restriction (例如smtpd_recipient_restriction)放置此行

 check_recipient_access hash:/etc/postfix/mycontentfilter 

/etc/postfix/mycontentfilter

 example.com FILTER foo:bar 

你可以在amavisd文档中find另一个例子。