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 want a setup where an e-mailaddress like redirects mail to the folder foo. I've already got dovecot configured and tested. It is called by postfix with this line in

dovecot unix    -       n       n       -       -      pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension}

I expect ${extension} to expand to 'foo' but it is always empty.

I've added

recipient_delimiter = +

to my

How can I get it to work?

I've got a catch-all alias that redirects to It seems that the extension is empty because of this. So the question becomes: Can I have a catch-all so that redirects to without explicitly defining either the random or the ext part?

share|improve this question

You will need to use a regexp map for this to work.

Here's snippet of a post from Wietse on the matter.

You can use regexp tables instead of fixed-string maps, and do arbitrary address transformations:

/\+([^+]+)@example\.com$/   localuser2+$1localhost 

You can get explanation of regex scheme in regex101. In short, the bracket () will capture the extension and pass it to your alias.

share|improve this answer

I have a similar setup using Postfix and CourierIMAP. You could try using procmail to handle this. I have a wildcard set up so that all mail goes to one user, and then use procmail rules to filter e-mail into various folders based on the address it was sent to.

For example, this would filter e-mail to adsense or google into a Google folder:

* ^(To|CC|BCC).*(adsense|google)\@domain\.com

To expand on this for your purpose, you could use a more advance rule like this:

* ^(To|CC|BCC).*user\+\/.*\@domain\.com
.`echo $MATCH | sed 's/\@.*//'`/

However, note that the folder would be case-sensitive, and you would need to make sure the folder has been created. You could get more advanced and just do scripting to create folders when they don't already exist if necessary.

share|improve this answer

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.