postfix/dovecot: deliver per-user unlimited aliases to individual folders

1

Context

On a Debian server hosting a small-traffic domain, a decent e-mail setup runs postfix as SMTP server and dovecot as IMAP.

Postfix configuration includes this:

recipient_delimiter = _

which causes addresses liks user_anyword@domain to be delivered to folder INBOX of user@domain. So far, so good.

Wish : user_anyword@domain to folder anyword

We wish that mail addressed to user_anyword@domain be delivered to folder anyword of user user@domain.

Search before you post

These pages are probably highly relevant:

Possible approach

It can probably be achieved based on http://wiki.dovecot.org/LDA/Postfix and http://www.postfix.org/postconf.5.html#recipient_delimiter . The idea would be to leverage the configuration between postfix and dovecot-lda and add a -m parameter to tell the destination folder:

mailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT" -m "${recipient_delimiter}${extension}"

Those dovecot-lda options would probably be useful:

lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes

I might probably try that soon. Any comment? Can you offer variants or different solutions?

Stéphane Gourichon

Posted 2016-12-27T14:42:39.860

Reputation: 519

1

Have you looked at Sieve? I think it's the recommended way for sorting delivery into folders for Dovecot, and there is an example config that seems to do what you want. Maybe using subaddress, fileinto, variable options as shown at http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples#Plus_Addressed_mail_filtering .

– Guy – 2016-12-31T22:41:35.043

Answers

0

Here's what I'd recommend:

  1. Use LMTP to send from postfix to dovecot
  2. At it says at the bottom of the LMTP page, set

    lmtp_save_to_detail_mailbox = yes
    recipient_delimiter = _
    

user169501

Posted 2016-12-27T14:42:39.860

Reputation: