$ postmap -q f...@mydomain.com regexp:/etc/postfix/virtual
b...@somewhere-else.tld

Yet, if postfix actually receives a message destined for
f...@mydomain.com, I see this log activity:

May 21 18:37:02 bks-mail2 postfix/smtp[5803]: C728A1100053:\
to=<b...@myotherdomain.com>, orig_to=<f...@mydomain.com>,\
relay=mx1.myotherdomain.com[<IP>]:25, delay=1, delays=0.36/0/0.26/0.4,\
dsn=2.0.0, status=sent (250 ok:  Message 223824627 accepted)

Which is confounding. I expected postfix to send the message to
b...@somewhere-else.tld as defined in regexp:/etc/postfix/virtual, and
clearly some pattern matching did occur because the actual recipient was
'bar'. How is a partial substitution by regexp possible? The only places
myotherdomain.com is mentioned are postfix/virtual and
postfix/sender_access. Perhaps regexp continues processing
postfix/virtual after the first match and also substitutes based on the
final catch-all rule?

.:      postfix/main.cf
myhostname = mx1.mydomain.com
myorigin = $mydomain
mydestination =
local_recipient_maps =
mynetworks_style = host
smtpd_recipient_restrictions =
        permit_mynetworks
        check_sender_access hash:/etc/postfix/sender_access
        reject_unauth_destination
local_transport = error:local mail delivery is disabled
virtual_alias_domains = mydomain.com mydomain.co.uk
virtual_alias_maps = regexp:/etc/postfix/virtual
parent_domain_matches_subdomains =
        debug_peer_list
        smtpd_access_maps

.:      postfix/virtual
/^foo@/         b...@somewhere-else.tld
/^([...@]+)@/   $...@myotherdomain.com

.:      postfix/sender_access
@myotherdomain.com      OK
@myotherdomain.co.uk    OK

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to