Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having problems trying to configure a catch all email in postfix.

I have an email account 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, e.g. and, to this email account.

After doing some research I've done the following but to no avail.

In /etc/postfix/ I have added the line

virtual_alias_maps = hash:/etc/postfix/virtual

In /etc/postfix/virtual I have added

/.*   messages

Any help is appreciated! Thanks.

share|improve this question
up vote 1 down vote accepted

Nowhere is it documented that hash maps support this kind of wildcarding - you're probably thinking about regexp or PCRE tables:

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.

share|improve this answer
Actually, \d+ will only match digits and the user wants to match everything so \w+ should be used. Also, a quick way to check it's working is by using postmap (yes it works) like that: postmap -q '' pcre:/etc/postfix/wildcard.pcre – fim Mar 1 '12 at 11:11
@adaptr Thanks for your response. I've created wildcare.pcre as suggests and run the command above, but it returns nothing. Do I take that as a sign it is working? Do I need to reference the pcre table in – leejmurphy Mar 1 '12 at 15:03
...yes, obviously. Just add it at the end of your virtual_alias_maps config: virtual_alias_maps = hash:/etc/postfix/virtual, pcre:/etc/postfix/wildcard.pcre – adaptr Mar 1 '12 at 15:07
Nothing seems to be happening. are still being routed, but aren't, nor are they being returned to sender. I've tried checking the maillog but for some reason it hasn't updated since this morning, probably another issue entirely – leejmurphy Mar 1 '12 at 15:28
my bad, i missed the backslash escape on the .com. Seems to be working great, thanks! – leejmurphy Mar 1 '12 at 15:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.