title: Postfix+Dovecot - How to receive mail for anyuser@anydomain
body: <p>So the main idea is that I want to do something like this:</p>
  
  <p>1) I send email to anyrandomuser@anyofmydomain.com</p>
  
  <p>2) I receive it with Dovecot, or at least store it in maildir like:
   /vmail/%anydomain/%anyuser</p>
  
  <p>I tried something like this:</p>
  
  <p>cat /etc/postfix/main.cf</p>
  
  <pre><code>inet_interfaces = all
  inet_protocols = ipv4
  
  relay_domains = *
  virtual_mailbox_domains=hash:/etc/postfix/vmail_domains
  virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox
  
  virtual_mailbox_base = /var/vmail
  virtual_minimum_uid = 2222
  virtual_transport = virtual
  virtual_uid_maps = static:2222
  virtual_gid_maps = static:2222
  </code></pre>
  
  <p>cat /etc/postfix/vmail_mailbox</p>
  
  <pre><code>@d1.com     d1.com/catchall/
  @d2.com     d2.com/catchall/
  @d3.com     d3.com/catchall/
  </code></pre>
  
  <p>So that is working pretty well. But its limited to domain-list in /etc/postfix/vmail_mailbox and all mails endup in the same directory. I tried to do some sorting with pcre-map like this:</p>
  
  <p>cat /etc/postfix/vmail_mailbox_pcre </p>
  
  <pre><code>/([^\@]+)@([^\s]+)/ ${2}/${1}/
  </code></pre>
  
  <p>But it doesnt work. That's what i get in log:</p>
  
  <pre><code>Jan 26 09:41:04 localhost postfix/virtual[5579]: warning: pcre map /etc/postfix/vmail_mailbox_pcre, line 1: regular expression substitution is not allowed: skipping this rule
  </code></pre>
  
  <p>Has anyone done something like that? I'm open to any help. Thanks.</p>