Debian – postfix, dovecot, virtual_mailbox_maps Mailbox format

debiandovecotpostfix

I have installed on debian (wheezy) postfix and dovecot.

My mails delivers only if the file 'virtual_mailbox_maps' is in Maildir format:

admin@mydomain.com mydomain.com/admin/Maildir/
admin@mydomain2.com mydomain2.com/admin/Maildir/

But earlier I had 'virtual_mailbox_maps' in Mailbox format:

admin@mydomain.com mydomain.com/admin
admin@mydomain2.com mydomain2.com/admin

and mails delivered fine. But if I use Mailbox format now I get error

postfix/virtual[11364]: B95A52C0C19: to=<admin@mydomain.com>, relay=virtual, delay=12920, delays=12920/0.01/0/0, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/mydomain.com/admin: cannot open file: Is a directory)

Adding a slash at the end of each lines fixed issue, but this changes format from Mailbox to Maildir.

In dovecot config file:

mail_location = maildir:/var/vmail/%d/%n/Maildir

So, what option I have lost in dovecot config or in postfix config?

I want to preserve the old way:

admin@mydomain.com mydomain.com/admin
admin@mydomain2.com mydomain2.com/admin

without adding "/Maildir/" at the end of each line. If I add only a slash instead of "/Maildir/" at the end of each line then directories "cur", "new" and "tmp" creates at the "…./admin/" instead of "…/admin/Maildir/" and Thunderbird don't see my mails.

Best Answer

Convert current maildirs to mailboxes according this article on Dovecot wiki. There is a simple perl script for this task using reformail tool from maildrop package or formail from procmail package.

Then, switch Dovecot to deliver to users' mailboxes instead of maildirs with this directive

mail_location = maildir:/var/vmail/%d/%n

Remember that %n is used in maildir format definition and it is in conflict with new mailbox definition (error in postfix maillog) so you will have to rename the original maildir to resolve it. Finally, don't forget to reload related services to apply these changes.