I've come across a situation in Postfix where it seems that my configuration is being ignored. I have a home network where the machines are named hostname.fakedomain, and a colo mail host with a real domain example.com. On my home machine, Postfix is configured to rewrite envelope addresses to use the real domain example.com, but to preserve the headers as-is. I keep this setup because I want mail to be delivered to my colo mail server, but I like preserving the headers so that I can see at a glance which machine on my home network sent which mail.
- Arch Linux
- Postfix 2.7.2
"postconf -n" (partial output):
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
Normally, this works just fine: local mail on my desktop is delivered to the postmaster account on my mail server, but the headers are not rewritten. However, if the mail as provided to the sendmail binary is missing the From: header, then the header is rewritten to
From: root <email@example.com>. Since canonical_classes doesn't include "header_sender", this doesn't seem like it should happen. What I thought would happen is that Postfix would add
From: firstname.lastname@example.org. Also, I know that this is due to the canonical map, because if I change the address there to "email@example.com", the headers change as well.
One possible workaround would be to pipe each cron entry's output through /bin/mail, but I would prefer a Postfix configuration fix, so that this works for any mail that is missing a From: header, rather than just cron mail.
Is this actually a bug in Postfix, or am I misunderstanding how canonical_classes should work in this situation?