This will allow you to match incoming mail by regex and redirect it to any other mail but will break the Catch-ALL rule in the Aliases.
(Assume that you are root
and repo was cloned into the /root/mailcow-dockerized
)
Override main.cf
nano /root/mailcow-dockerized/data/conf/postfix/extra.cf
Add new line
virtual_alias_maps = regexp:/opt/postfix/conf/aliases-regexp
Add regex rules
nano /root/mailcow-dockerized/data/conf/postfix/aliases-regexp
/^prefix1(.*)@mydomain.com$/ [email protected]
/^prefix2(.*)@mydomain.com$/ [email protected]
Restart the postfix container