修改Postfix消息内容

我正在使用postfix邮件服务器,我需要根据一些预定义的规则来replace每个传入和传出邮件中的邮件内容。

所需要的是过滤远程和本地邮件,以用[email protected]replace标头或正文中的[email protected]每个实例

header_checks和body_checks选项看起来很麻烦,也许有更好/更快的选项,在整个消息上工作,而不是一行一行

发送邮件中的Postfix支持标题地址重写:

smtp_generic_maps = hash:/etc/postfix/generic_map 

/等/后缀/ generic_map

 [email protected] [email protected] # postmap /etc/postfix/generic_map 

使用正则expression式:

 smtp_generic_maps = regexp:/etc/postfix/generic_map.regexp 

/等/后缀/ generic_map

 (.*?)@example.com [email protected] 

不支持身体变化。 您需要创build自己的内容filter。

http://www.postfix.org/postconf.5.html#smtp_generic_maps

您应该查看内容filter,如Postfix的文档中所述 。

您可能想要使用队列前内容filter。 这可能很容易写入像Perl或Python的东西。 前队列filter的Postfix指南还链接到一个名为smtpprox的程序,您可能可以根据需要重新调整用途。