I run a Postfix server that handles several domains, and a handful of users on each domain, and I am using
virtual.pcre to allow various useful aliases (for example,
/user-.*@ myuser to deliver email to
firstname.lastname@example.org, etc to the
However, a thing that I keep running into is if an outgoing email address happens to match one of the PCRE rules (for example,
email@example.com), it gets delivered directly to the
myuser account, rather than being sent out.
I would like to avoid having to configure these mappings for all of my incoming domains, and would only like Postfix to actually handle the virtual addresses that it's configured to look at.
A simplified/genericized version of my
/etc/postfix/virtual.pcre is below:
/somedomain\.example/ VIRTUAL /otherdomain\.example/ VIRTUAL /someuser@/ myuser /someuser-.*@/ myuser /abuse@/ myuser /otheruser@/ other /otheruser-.*@/ other
And in my
main.cf I have:
virtual_alias_maps = pcre:/etc/postfix/virtual.pcre virtual_alias_domains = $virtual_alias_maps
I had thought that the initial
VIRTUAL match on the domain is what was necessary to configure Postfix to only try to handle said domain (via the
virtual_alias_domains directive in
main.cf), but it seems that I am missing something, as this ends up intercepting all outgoing email (for example,
firstname.lastname@example.org gets delivered to the
So, is there a way to make Postfix only handle the virtual domains that I declare in
/etc/postfix/virtual.pcre, without undergoing a combinatorial explosion of username/domain pairs?