我遇到了Postfix的情况,似乎我的configuration被忽略。 我有一个家庭networking,其中的机器被命名为hostname.fakedomain,并与一个真正的域example.com colo邮件主机。 在我的家用机器上,Postfix被configuration为重写信封地址以使用真实的域example.com,但保留标题原样。 我保留这个设置,因为我想把邮件发送到我的邮件服务器,但是我喜欢保存邮件头,以便我一眼就能看到家庭networking上的哪台机器发送了哪些邮件。
相关细节:
/等/后缀/规范:
@hostname.fakedomain [email protected]
“postconf -n”(部分输出):
alias_database = $ alias_maps alias_maps = hash:/ etc / postfix / aliases canonical_classes = envelope_sender,envelope_recipient canonical_maps = hash:/ etc / postfix / canonical mydestination = myhostname = hostname.fakedomain relay_domains = relayhost = example.com
通常情况下,这工作得很好:我的桌面上的本地邮件被传递到我的邮件服务器上的邮局主pipe帐户,但头不会被重写。 但是,如果提供给sendmail二进制文件的邮件缺lessFrom:标题,那么标题将被重写为From: root <[email protected]> 。 由于canonical_classes不包含“header_sender”,这似乎不应该发生。 我想会发生的是,后缀将添加From: [email protected] 。 另外,我知道这是由于规范映射,因为如果我把地址改为“[email protected]”,那么标题也会改变。
一种可能的解决方法是通过/ bin / mailpipe道输出每个cron条目的输出,但我更喜欢Postfixconfiguration修复,这样可以适用于任何缺lessFrom:头的邮件,而不仅仅是cron邮件。
这实际上是一个错误的Postfix,或者我误解canonical_classes应该如何在这种情况下工作?
可能检查这两个: remote_header_rewrite_domain和local_header_rewrite_clients
后者默认为“permit_inet_interfaces”,在这个其他参数的描述中,可能会给你答案?
always_add_missing_headers (default: no): Always add (Resent-) From:, To:, Date: or Message-ID: headers when not present. Postfix 2.6 and later add these headers only when clients match the local_header_rewrite_clients parameter setting. Earlier Postfix versions always add these headers; this may break DKIM signatures that cover non-existent headers.**
即使默认值是no,也许local_header_rewrite_clients参数不是空的导致这个。
不过,我也可以添加以下内容(从手册页):
The canonical(5) mapping is not to be confused with virtual alias support or with local aliasing. To change the destination but not the headers, use the virtual(5) or aliases(5) map instead.**
虽然你在做什么应该工作,也许使用虚拟/别名会更好?
哦,还发现还有sender_canonical_classes和recipient_canonical_classes参数。 可能要检查这些。