Dear Postfix-Users, I’m using sender_canonical_maps to ensure that my envelope addresses comply with SPF policies and also allow for a valid bounce address in the event of non-delivery.
My gateway mail servers are configured using sender_canonical_maps with "sender_canonical_classes = envelope_sender” and this works as expected for internet mail submission (i.e. smtpd:25), but not for local submission on the gateway mail server. The problem I am having is that any mail that is submitted locally on the gateway mail servers (Ubuntu, /usr/bin/mail - tested all 3 packages providing /usr/bin/mail) behaves as if sender_canonical_classes is not configured — i.e. default configuration behaviour of “sender_canonical_classes = envelope_sender, header_sender” — as both the envelope and header addresses are being rewritten. I have also tested with canonical_maps and canonical_classes configured appropriately the same behaviour is observed. My configuration reads as follows (canonical_classes added as a precaution): # /etc/postfix/main.cf (excerpt) canonical_classes = envelope_sender sender_canonical_classes = envelope_sender sender_canonical_maps = regexp:/etc/postfix/sender_canonical.regexp The regexp canonical map rules: # /etc/postfix/sender_canonical.regexp (excerpt) # rewrite all addresses to any variant of (*.|)mydomain.com(|.*) to realuser+user%internal_f...@mydomain.com /^(.*)@(.+\.mydomain\.com(\.[^\.]*)?)$/ realuser+${1}%${2}@mydomain.com At the moment I have an extra custom entry in each gateway mail host excluding it from the rewrite - rewriting it as it is received - which I’d rather avoid. # /etc/postfix/sender_canonical.regexp # exception required due to {{sender,recipient}_}canonical_classes not being honoured by local delivery transport /^(.*)@(this\.host\.mydomain\.com)$/ ${1}@${2} I have read all of the documentation in question so I’m not sure if I’ve found a bug or if I just have misunderstood the message processing / routing within Postfix relating to address rewriting. I’m hoping someone has more insight into the issue I’m seeing or to educate me in the event I have just misunderstood something. cheers, Valdemar