我将设置Postfix以根据接收者来编辑标题。这是通过header_checks(http://www.postfix.org/header_checks.5.html)
完成的逻辑如下:如果将电子邮件发送到“ [email protected]”,则我们复制“发件人”字段并将其粘贴到“回复至”字段,“发件人”字段也设置为“ [email protected]”。
我没有使用正则表达式的经验,但是通过一些搜索,我得出了以下结论:
if /^To: ([email protected])\s.*$/
/^From: (.+@.+)\s.*$/ PREPEND Reply-To:$1
/^From: (.+@.+)\s.*$/ REPLACE From: [email protected]
endif
这不起作用。我不确定语法有什么问题,但是任何帮助将不胜感激。
问候埃里克
问题是,每个电子邮件行只对header_checks进行一次,因此跳过了seconf“ From”行(第3行)。
似乎接受的答案可能会误导。
如果与header_checks中的if-endif进行斗争,则应保留以下内容:
If the input string matches /pattern/, then match that input
string against the patterns between if and endif. The if..endif
can nest
来自http://www.postfix.org/header_checks.5.html
注意“然后匹配that输入字符串”。这意味着您不能在if / endif块中操作任何标头,但可以在if语句中使用该标头。