Redirecting wildcard email to one email with postfix
As have said mschuett, you can use regexp
First check that postfix supports regexp:
root @ mail / # postconf-m | grep regexp regexp root @ mail / #
Create the file /etc/postfix/aliases-regexp and add to it your regexp
root @ mail / # cat /etc/postfix/aliases-regexp /notification-message-[0-9][email protected]\.net/ [email protected] root @ mail / #
Run postmap and check whether it works:
root @ mail / # postmap /etc/postfix/aliases-regexp root @ mail / # postmap -q [email protected] regexp:/etc/postfix/aliases-regexp [email protected] root @ mail / #
If everything is OK, add this file to your alias database
root @ mail / # cat /etc/postfix/main.cf | grep ^alias_maps alias_maps = hash:/etc/aliases regexp:/etc/postfix/aliases-regexp root @ mail / #
If you are using virtual domains, add this file to your virtual_alias_maps
root @ mail / # cat /etc/postfix/main.cf | grep ^virtual_alias_maps virtual_alias_maps = mysql:/etc/postfix/mysql/alias.conf regexp:/etc/postfix/aliases-regexp root @ mail / #
Do not forget to restart postfix.
Alias maps (virtual, local, ...) will work in combination with the regexp_table format. But if you have compiled in PCRE, then you can also use the pcre_table format.
Otherwise you should search for "Postfix catch-all" which is a bit more greedy.
I'd be inclined to solve this using
If you don't mind using slightly different
Reply-To addresses, you can set:
recipient_delimiter = +
in your config, and then mail to e.g.
[email protected] (note the
+) will be delivered to the
notification user (assuming there are no more-specific rules/users matching
You could try setting
recipient_delimiter = - (so that you could use the
Reply-To headers as they are in the question) but I'm not sure how that would work with multiple instances of the delimiter on the left-hand side, and I don't have a Postfix to hand to check.