Domain aliases in Postfix / Dovecot setup

dovecotpostfix

My mailserver is known by 3 different domains, e.g. mail.local, mail.foo.example.com, mail.bar.example.com. I want delivery to be the same no matter which address was chosen. Ideally I want dovecot to put user@mail.any.of.those into the user mailbox, i.e. not into user@some.domain.

I'm not even sure, if this is to be solved by some alias maps in postfix, or by settings in dovecot.

What I do currently is:

# main.cf
virtual_transport = dovecot
virtual_mailbox_domains= mail.local, mail.foo.example.com, mail.bar.example.com
dovecot_destination_recipient_limit = 1 

# master.cf
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${user} -a ${recipient}

But this puts mail for user@mail.local into MAILDIR/user@mail.local/Maildir/new

Best Answer

As it seems dovecot-lda can do the trick using the -a argument:

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${user} -a ${user}