I want to redirect all local mail by specifying an address in virtual_alias_maps file.
It is possible to match recipients with regexp, but it's too complex. They can be:
- no domain (
root
etc.) root@localhost
root@myserver
Here: http://forums.debian.net/viewtopic.php?f=16&t=107671 they try to match /.+@.+\.localdomain/
, which of course doesn't work.
Postfix already has $mydestination
config parameter. Can I match with it somehow?
Upd: tried local_transport = virtual:
, but virtual cannot forward.
Perhaps a global .forward
file will help?
Don't use
virtual_alias_maps
, usealias_maps
instead.virtual_alias_maps
match all address classesalias_maps
match only local address class i.e. address defined inmydestination
parameterSee Address Class README for more information.
So, the parameter of
alias_maps
would becomeAlternatively, you can put
forward_path = /etc/postfix/global-forward
inmain.cf
. Basically, you override the path of.forward
file for EVERY user.In
/etc/postfix/global-forward
just putNo need to specify the left side mapping.
Credit to OP for this workaround.