Postfix wildcard alias for DOMAINS

Is there a way to use an wildcard for the domainname, like

webmaster@*

Wildcards for addresses on a domain are working with "@domain", but "hostmaster@" does not work.

current setup with *@domain wildcard:

main.cf:

virtual_alias_maps = hash:/etc/postfix/virtual

virtual (wildcard for domain, one mailadress for domain2):

domain anything
domain2 anything
@domain user@localhost
mail@domain2 user2@localhost

and now i want to have some standard addresses for every domain, like

webmaster@ user3@localhost

But this syntax does not work in that way. One option would be to add the address to each (non-wildcard) domain by hand, another option may be to use a pcre map for the virtual table. But using a pcre-table for aliases seems too unclean and adding them by hand is what i want to avoid.


Solution 1:

I believe you'd want to use a regexp type map file and then you could do something like

/^webmaster@/ user3@localhost

If you want to keep the existing hash virtual file as well I suppose the config directive would be something like

virtual_alias_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regex