email - 使用 Postfix 转发邮件,将 FROM 移动到 REPLY-TO 然后重写 FROM

标签 email emailrelay

我想做的是:

为外发邮件设置 SMTP 中继,其中:
(a) 所有发件人:标题被重写为“no-reply@example.com”
(b) 添加带有原始 From: 地址的 Reply-To: header

我正在使用 sender_cannoical_maps header_checks ,各内容如下:

sender_canonical_maps:

/.*/    no-reply@example.com

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

但是当收到一条消息时,没有回复地址包含在 Reply-To: 字段中,这是我不想要的:
to:         end-user@example.com
from:       no-reply@example.com
reply-to:   no-reply@example.com, sender@domain.com

如果我将 header_checks 更改为使用 REPLACE 而不是 PREPEND,则会丢失被覆盖的原始发件人:
to:         end-user@example.com    
from:       no-reply@example.com
reply-to:   no-reply@example.com

所以我丢失了sender@domain.com。

我在这里做错了什么?并为任何缺乏信息提前道歉。

最佳答案

header_sendersender_canonical_classes (默认)然后 postfix 将在处理 sender_cannonical_maps 时重写 From 和 Reply-To header .所以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

关于email - 使用 Postfix 转发邮件,将 FROM 移动到 REPLY-TO 然后重写 FROM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32162527/

相关文章:

javascript - 满足某些条件后发送电子邮件

python - 从 python 通过 sendmail 发送邮件

python - 如何在 Python 中发送带有 pdf 附件的电子邮件?

sql-server - 使用数据库邮件作为电子邮件中继服务器是个好主意吗?

linux - 在 Postfix 中配置备份邮件中继

java - 从 java 应用程序 : Relaying denied 发送电子邮件时出现异常

java - 如何在android中发送html电子邮件?

html - 有没有办法在 html 电子邮件中的 "a:hover"上的 href 链接上设置内联样式?

email-headers - X-Sender-Id 在电子邮件原始来源(在网络钓鱼电子邮件中找到)中的含义是什么?