[Dovecot] LAYOUT=maildir++ under mbox?

William Blunn bill+dovecot at blunn.org
Mon Sep 6 18:36:27 EEST 2010


On 06/09/2010 15:07, Timo Sirainen wrote:
> On Mon, 2010-09-06 at 12:37 +0100, William Blunn wrote:
>    
>> Whilst documenting LAYOUT=maildir++ under dbox, that got me thinking:
>>
>> Can we specify :LAYOUT=maildir++ with mbox?
>>      
> Yes, ever since LAYOUT was added.
>
>    
>> If I have it right, this should then remove the problem of not being
>> able to have messages and mail subfolders in the same mail folder.
>>      
> Yes. Also it might be possible to use DIRNAME with LAYOUT=fs to solve
> that problem, but I'm less sure about that. I anyway doubt most mbox
> users want to switch to a whole new layout.
>    

OK. Tried that. The results are interesting.

If you use:

     mail_location = mbox:~/mail:DIRNAME=mail

then INBOX mail gets put into a file at "~/mail/inbox" with indexes at 
"~/mail/INBOX/mail/dovecot.*"

"folder" mail gets put into an mbox file at "~/mail/folder/mail".

We don't get any indexes, presumably because Dovecot is trying to put 
the indexes at "~/mail/folder/mail/dovecot.*" which of course can't work 
because there is already a file where it wants to put a directory.

However we can also put mail into folder "folder/subfolder", which goes 
into an mbox file "~/mail/folder/subfolder/mail".

So we are now magically able to put both messages and subfolders into 
folders. Cool.

But we don't have indexes. But we can fix the indexes by adding an INDEX 
parameter.

     mail_location = mbox:~/mail:DIRNAME=mail:INDEX=~/mail/.index

This then seems to make everything work with indexes at:

INBOX : ~/mail/.index/INBOX/dovecot.*
"folder" : ~/mail/.index/folder/dovecot.*
"folder/subfolder" : ~/mail/.index/folder/subfolder/dovecot.*

So possibly an answer for people who want to use mbox format but also 
want to be able to put both messages and subfolders into folders.

I may pop this into http://wiki2.dovecot.org/MailLocation/mbox

>> So for example if we had mail location specified as:
>>
>> mail_location = mbox:~/mail:LAYOUT=maildir++
>>
>> we would have files:
>>
>> ~/mail/inbox - file storing messages in INBOX
>> ~/mail/.foo - file storing messages in mail folder "foo"
>> ~/mail/.foo.bar - file storing messages in mail folder "foo/bar"
>>
>> and I think all of Dovecot's indexes would go under ~/mail/.imap
>>      
> I think it'll give an error (by trying to write to ~/mail/.foo/.imap/dovecot.index) unless you also specify :INDEX=directory separately.
>    

This doesn't work so well. Using

   mail_location = mbox:~/mail:LAYOUT=maildir++

Mail for INBOX goes to an mbox file "~/mail/inbox".

Mail for folder "folder" goes to an mbox file "~/mail/.folder".

But mail for folder "folder/subfolder" gets stuffed into "~/mail/inbox".

And also we get no indexes.

We can fix the indexes using the INDEX parameter, but this doesn't help 
not being able to deliver to any folder more than one level deep.

Bill


More information about the dovecot mailing list