Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want a setup where an e-mailaddress like user+foo@domain.com redirects mail to the folder foo. I've already got dovecot configured and tested. It is called by postfix with this line in master.cf:

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 main.cf.

How can I get it to work?

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

share|improve this question

2 Answers 2

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 @domain.com 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

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

Here's a post from Wietse on the matter. http://archives.neohapsis.com/archives/postfix/2007-04/0519.html

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.