I'm having problems trying to configure a catch all email in postfix.
I have an email account messages@example.com
. All emails sent to this address are piped to a php script.
What I would like to do is forward all emails in the format anything.messages@example.com
, e.g. 3454534.messages@example.com
and dsf843fdd.messages@example.com
, to this email account.
After doing some research I've done the following but to no avail.
In /etc/postfix/main.cf I have added the line
virtual_alias_maps = hash:/etc/postfix/virtual
In /etc/postfix/virtual I have added
/.*messages@example.com messages
Any help is appreciated! Thanks.
Best Answer
Nowhere is it documented that hash maps support this kind of wildcarding - you're probably thinking about regexp or PCRE tables:
http://www.postfix.org/PCRE_README.html
http://www.postfix.org/pcre_table.5.html
Something like this should work:
/etc/postfix/wildcard.pcre:
/^\d+\.message@example\.com$/ message
Note that PCRE maps are not compiled; don't run
postmap
on them.However, I would strongly suggest you switch to using recipient delimiters instead; it makes all of this unnecessary.