[Dovecot] LAYOUT=maildir++ under mbox?
Whilst documenting LAYOUT=maildir++ under dbox, that got me thinking:
Can we specify :LAYOUT=maildir++ with mbox?
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.
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
Bill
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.
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.
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
On Mon, 2010-09-06 at 16:36 +0100, William Blunn wrote:
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".
Did you have a namespace defined? If not, the separator is '.' and not '/', maybe that's the problem? Or anyway I guess there was some error logged why it didn't go to where you wanted. In my test it works fine.
On 06/09/2010 16:41, Timo Sirainen wrote:
On Mon, 2010-09-06 at 16:36 +0100, William Blunn wrote:
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".
Did you have a namespace defined? If not, the separator is '.' and not '/', maybe that's the problem? Or anyway I guess there was some error logged why it didn't go to where you wanted. In my test it works fine.
OK, no I didn't have a namespace defined.
I have now tried it with a namespace with an explicit separator of '/' and it now all works.
namespace { type = private separator = / location = mbox:~/mail:LAYOUT=maildir++:INDEX=~/mail/.index inbox = yes hidden = no list = yes subscriptions = yes }
Mail for INBOX goes to an mbox file at "~/mail/inbox" with indexes at "~/mail/.index/.INBOX/dovecot.*" Mail for "folder" goes to an mbox file at "~/mail/.folder" with indexes at "~/mail/.index/.folder/dovecot.*" Mail for "folder/subfolder" goes to an mbox file at "~/mail/.folder.subfolder" with indexes at "~/mail/.index/.folder.subfolder/dovecot.*"
I think what confused me was that it seems that under Maildir the default separator is '/', so "folder/subfolder" gets mapped to ".folder.subfolder".
But under mbox the default separator is '.' (even if LAYOUT=maildir++ is specified!), so "folder/subfolder" doesn't get mapped to ".folder.subfolder" (perhaps it ends up as ".folder/subfolder"?) so it doesn't work.
I suppose in theory perhaps the default separator should be based on the LAYOUT rather than the mailbox format, viz.
Under LAYOUT=fs perhaps the default_separator ought to be '.', and under LAYOUT=maildir++ perhaps the default_separator ought to be '/', regardless of the mailbox format :-)
Bill
On Mon, 2010-09-06 at 16:57 +0100, William Blunn wrote:
I think what confused me
I think you're still confused :)
Under LAYOUT=fs perhaps the default_separator ought to be '.', and under LAYOUT=maildir++ perhaps the default_separator ought to be '/', regardless of the mailbox format :-)
It works like that, except the opposite way. With LAYOUT=fs the default separator is '/' because the hierarchies are separated by the '/' directory separator. With Maildir++ it's '.', because the separator in disk is '.'.
So only the layout determines what hierarchy separator is in use. Of course, each mailbox format has their default layout.
On 9/6/10 12:30 PM, Timo Sirainen wrote:
Under LAYOUT=fs perhaps the default_separator ought to be '.', and under LAYOUT=maildir++ perhaps the default_separator ought to be '/', regardless of the mailbox format :-)
It works like that, except the opposite way. With LAYOUT=fs the default separator is '/' because the hierarchies are separated by the '/' directory separator. With Maildir++ it's '.', because the separator in disk is '.'.
So only the layout determines what hierarchy separator is in use. Of course, each mailbox format has their default layout.
This is only tangentially related, please forgive me for that, but is there any automated way to convert an existing hierarchy of '.'-separated folders to a LAYOUT=fs configuration?
-Dave
-- Dave McGuire Port Charlotte, FL
On Mon, 2010-09-06 at 12:37 -0400, Dave McGuire wrote:
This is only tangentially related, please forgive me for that, but is there any automated way to convert an existing hierarchy of '.'-separated folders to a LAYOUT=fs configuration?
dsync can do it, although not very optimally (copies all mails rather than just renaming the mailboxes). Anyway works basically the same as any other conversion, e.g.:
mail_location = maildir:~/Maildir
dsync mirror maildir:~/Maildir-fs:LAYOUT=fs
Of course the last problem is that any existing clients will probably need to recreate their accounts or the clients become confused.
On 06/09/2010 17:30, Timo Sirainen wrote:
On Mon, 2010-09-06 at 16:57 +0100, William Blunn wrote:
I think what confused me
I think you're still confused :)
I think you're right.
Under LAYOUT=fs perhaps the default_separator ought to be '.', and under LAYOUT=maildir++ perhaps the default_separator ought to be '/', regardless of the mailbox format :-)
It works like that, except the opposite way. With LAYOUT=fs the default separator is '/' because the hierarchies are separated by the '/' directory separator. With Maildir++ it's '.', because the separator in disk is '.'.
So only the layout determines what hierarchy separator is in use. Of course, each mailbox format has their default layout.
OK. So it does.
I'd been running tests targetting the folder "foo/bar", always with a slash separator.
For some reason I had it that with maildir this was mapping down to ".foo.bar/", but I just tested that again and it doesn't --- the mail just ends up in INBOX.
But if I target "foo.bar" undir Maildir it all works.
OK, my mental world model updated to what you just said; now consistent with all test results.
Thanks.
Bill
participants (3)
-
Dave McGuire
-
Timo Sirainen
-
William Blunn