将邮件使用Postfix转发,将发送者移动到回复地址(REPLY-TO),然后重写发送者(FROM)。

6

我需要做的是:

为发出的电子邮件设置SMTP中继,其中:
(a) 所有的From:头都会被重写为"no-reply@example.com"
(b) 添加一个带有原始From:地址的Reply-To:头

我正在使用sender_cannoical_mapsheader_checks,每个内容如下:

sender_canonical_maps:

/.*/    no-reply@example.com

header_checks:

/^From:(.*)$/   PREPEND Reply-To:$1

But when a message is received, the no-reply address is included in the Reply-To: field, which I do not want:

to:         end-user@example.com
from:       no-reply@example.com
reply-to:   no-reply@example.com, sender@domain.com

If I change header_checks to use REPLACE instead of PREPEND I lose the original sender which is overwritten:

to:         end-user@example.com    
from:       no-reply@example.com
reply-to:   no-reply@example.com

So I have lost sender@domain.com.

What I am doing wrong here? And apologies in advance for any lack of info.


我有同样的问题,你从任何人那里得到了解决方案吗? - A.Aleem11
我也是,同样的问题。这个问题有解决方案吗? - manifestor
1个回答

3
如果header_sendersender_canonical_classes中(默认情况下),那么在处理sender_cannonical_maps时,postfix将重写发件人和回复地址的标题。因此,header_check添加了回复地址,然后sender_cannonical_maps正在重写回复地址。为保留在header_checks中添加的回复地址,您需要……
sender_canonical_classes = envelope_sender
sender_cannoical_maps = static:no-reply@example.com

然而,这会保留原始的发件人头部信息(From header),但你可以通过在smtp_header_checks中添加内容来重写它。
smtp_header_checks = regex:/etc/postfix/smtp_header_checks

/etc/postfix/smtp_header_checks 的内容

/^From:(.*)$/   REPLACE From: no-reply@example.com

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接