[Dovecot] mbox, hierarchical folders/folders and IMAP
Hello,
I'm now dealing with funny problem. I try to use Dovecot (2.1.rc1, actually) and mbox format to store old mailing, to keep logic of "one folder = one file".
If I'd choose Maildir, I'd be able to create hierarchical folders (like "OldMail -> Maillists -> Dovecot"), and in fact on disk such a folders would be stored as real folders with dots in their names. In PHP it is easy to create with "imap_createmailbox()" function, I'd simple fire it 3 times (for "OldMail", for "OldMail.Maillists" and for "OldMail.Maillists.Dovecot").
But when I do the same with mbox, in fact it creates separate files (indeed, named "OldMail", "OldMail.Maillists" and "OldMail.Maillists.Dovecot") instead of creating filesystem folders ("OldMail/Maillists/Dovecot"). PHP is not guilty, Thunderbird won't create such folders as well. I can only create folders myself (say, with mkdir in the shell), chown it, and the it perfectly works in IMAP.
Now I just wanted to know, are there any way to create IMAP-folders and subfolders using standard IMAP functionality?
Thank you, Alexander
On 12/23/2011 10:00 AM, Alexander Chekalin wrote:
Hello,
I'm now dealing with funny problem. I try to use Dovecot (2.1.rc1, actually) and mbox format to store old mailing, to keep logic of "one folder = one file".
If I'd choose Maildir, I'd be able to create hierarchical folders (like "OldMail -> Maillists -> Dovecot"), and in fact on disk such a folders would be stored as real folders with dots in their names. In PHP it is easy to create with "imap_createmailbox()" function, I'd simple fire it 3 times (for "OldMail", for "OldMail.Maillists" and for "OldMail.Maillists.Dovecot").
But when I do the same with mbox, in fact it creates separate files (indeed, named "OldMail", "OldMail.Maillists" and "OldMail.Maillists.Dovecot") instead of creating filesystem folders ("OldMail/Maillists/Dovecot"). PHP is not guilty, Thunderbird won't create such folders as well. I can only create folders myself (say, with mkdir in the shell), chown it, and the it perfectly works in IMAP.
Now I just wanted to know, are there any way to create IMAP-folders and subfolders using standard IMAP functionality?
Yes. This has been common knowledge for many years, and is covered by lots of documentation, including dovecot and tbird docs. With mbox storage, an IMAP FOLDER contains only sub folders or it contains only messages. It CANNOT contain BOTH. Thunderbird forces you to answer this question each time you create a new IMAP FOLDER in the account root tree. Surely you've seen the radio buttons in the new folder creation box.
-- Stan
Stan, thank you for the reply,
But I believe I obey this rule: I create "folder with ONLY folders inside", then in it another "folder with ONLY folders inside", and the into this second folder I create "folder with ONLY messages inside" (the path is "oldmail/lists/dovecot", and oldmail and lists are folders in filesystem, while dovecot is mbox container in filesystem).
My problem is I can not understand which way should I create "folder with ONLY folders inside", and which way to create messages-only folder, going down to IMAP protocol commands. PHP for example looks like use only one command to create a mailbox, no difference what type of it I need.
I understand PHP isn't the only script language to deal with IMAP, so I seek for advice how IMAP works with on protocol level.
24.12.2011, в 13:31, Stan Hoeppner stan@hardwarefreak.com написал(а):
On 12/23/2011 10:00 AM, Alexander Chekalin wrote:
Hello,
I'm now dealing with funny problem. I try to use Dovecot (2.1.rc1, actually) and mbox format to store old mailing, to keep logic of "one folder = one file".
If I'd choose Maildir, I'd be able to create hierarchical folders (like "OldMail -> Maillists -> Dovecot"), and in fact on disk such a folders would be stored as real folders with dots in their names. In PHP it is easy to create with "imap_createmailbox()" function, I'd simple fire it 3 times (for "OldMail", for "OldMail.Maillists" and for "OldMail.Maillists.Dovecot").
But when I do the same with mbox, in fact it creates separate files (indeed, named "OldMail", "OldMail.Maillists" and "OldMail.Maillists.Dovecot") instead of creating filesystem folders ("OldMail/Maillists/Dovecot"). PHP is not guilty, Thunderbird won't create such folders as well. I can only create folders myself (say, with mkdir in the shell), chown it, and the it perfectly works in IMAP.
Now I just wanted to know, are there any way to create IMAP-folders and subfolders using standard IMAP functionality?
Yes. This has been common knowledge for many years, and is covered by lots of documentation, including dovecot and tbird docs. With mbox storage, an IMAP FOLDER contains only sub folders or it contains only messages. It CANNOT contain BOTH. Thunderbird forces you to answer this question each time you create a new IMAP FOLDER in the account root tree. Surely you've seen the radio buttons in the new folder creation box.
-- Stan
On 12/24/2011 10:26 AM, Alexander Chekalin wrote:
Stan, thank you for the reply,
But I believe I obey this rule: I create "folder with ONLY folders inside", then in it another "folder with ONLY folders inside", and the into this second folder I create "folder with ONLY messages inside" (the path is "oldmail/lists/dovecot", and oldmail and lists are folders in filesystem, while dovecot is mbox container in filesystem).
My problem is I can not understand which way should I create "folder with ONLY folders inside", and which way to create messages-only folder, going down to IMAP protocol commands. PHP for example looks like use only one command to create a mailbox, no difference what type of it I need.
I understand PHP isn't the only script language to deal with IMAP, so I seek for advice how IMAP works with on protocol level.
Ah, ok. I didn't fully understand your issue. Maybe Timo, or someone else, knows the necessary imap folder creation command sequence for this.
-- Stan
Hello Stan,
thank you for your care, the answer was pretty simple, and yes you're right, I'd better read the docs before:
I tried to create folder named like 'Old Mail' (and in fact I got another mbox container), while I needed to create 'Old Mail/' (note the slash), which results in real filesystem directory.
Thanks for your time anyway!
Yours, Alexander
25.12.2011 3:50, Stan Hoeppner пишет:
On 12/24/2011 10:26 AM, Alexander Chekalin wrote:
Stan, thank you for the reply,
But I believe I obey this rule: I create "folder with ONLY folders inside", then in it another "folder with ONLY folders inside", and the into this second folder I create "folder with ONLY messages inside" (the path is "oldmail/lists/dovecot", and oldmail and lists are folders in filesystem, while dovecot is mbox container in filesystem).
My problem is I can not understand which way should I create "folder with ONLY folders inside", and which way to create messages-only folder, going down to IMAP protocol commands. PHP for example looks like use only one command to create a mailbox, no difference what type of it I need.
I understand PHP isn't the only script language to deal with IMAP, so I seek for advice how IMAP works with on protocol level.
Ah, ok. I didn't fully understand your issue. Maybe Timo, or someone else, knows the necessary imap folder creation command sequence for this.
On 12/26/2011 12:43 AM, Alexander Chekalin wrote:
Hello Stan,
thank you for your care, the answer was pretty simple, and yes you're right, I'd better read the docs before:
I tried to create folder named like 'Old Mail' (and in fact I got another mbox container), while I needed to create 'Old Mail/' (note the slash), which results in real filesystem directory.
Oh wow, that is simple. And makes perfect sense. Before my last reply I read the php IMAP command set definitions/parameters and I didn't see anything about how to do this, which is an odd omission in documentation. I guess so few people use mbox these days they omit that case from the docs. I hit three different sources and none of them mentioned the trailing slash for creating 'sub-folders-only' folders...
Thanks for your time anyway!
You're welcome. Sorry I didn't get you the answer, but I'm glad you were able to figure it out on your own.
-- Stan
25.12.2011 3:50, Stan Hoeppner пишет:
On 12/24/2011 10:26 AM, Alexander Chekalin wrote:
Stan, thank you for the reply,
But I believe I obey this rule: I create "folder with ONLY folders inside", then in it another "folder with ONLY folders inside", and the into this second folder I create "folder with ONLY messages inside" (the path is "oldmail/lists/dovecot", and oldmail and lists are folders in filesystem, while dovecot is mbox container in filesystem).
My problem is I can not understand which way should I create "folder with ONLY folders inside", and which way to create messages-only folder, going down to IMAP protocol commands. PHP for example looks like use only one command to create a mailbox, no difference what type of it I need.
I understand PHP isn't the only script language to deal with IMAP, so I seek for advice how IMAP works with on protocol level.
Ah, ok. I didn't fully understand your issue. Maybe Timo, or someone else, knows the necessary imap folder creation command sequence for this.
On 26.12.2011, at 9.48, Stan Hoeppner wrote:
On 12/26/2011 12:43 AM, Alexander Chekalin wrote:
I tried to create folder named like 'Old Mail' (and in fact I got another mbox container), while I needed to create 'Old Mail/' (note the slash), which results in real filesystem directory.
Oh wow, that is simple. And makes perfect sense. Before my last reply I read the php IMAP command set definitions/parameters and I didn't see anything about how to do this, which is an odd omission in documentation. I guess so few people use mbox these days they omit that case from the docs. I hit three different sources and none of them mentioned the trailing slash for creating 'sub-folders-only' folders...
That's not PHP-specific, but rather IMAP-specific. It's in RFC 3501.
On 24/12/2011 10:31, Stan Hoeppner wrote:
With mbox storage, an IMAP FOLDER contains only sub folders or it contains only messages. It CANNOT contain BOTH.
Dovecot can store both folders and messages in a folder, under mbox.
See http://wiki2.dovecot.org/MboxChildFolders
Bill
On 12/29/2011 8:31 PM, William Blunn wrote:
On 24/12/2011 10:31, Stan Hoeppner wrote:
With mbox storage, an IMAP FOLDER contains only sub folders or it contains only messages. It CANNOT contain BOTH.
Dovecot can store both folders and messages in a folder, under mbox.
Not by default, and not without potential headaches. I'm still waiting to see someone post here that they're using this setup in a production environment, and that it works seamlessly with XYZ IMAP clients, backup software, current custom scripts without requiring a rewrite, etc. mbox capability in this regard hasn't changed for some 15-20 years until Timo suggested this with Dovecot.
The capability may exist, but until I see that it is being used successfully in production environments, I'm going to continue stating the standard mbox capability. To do otherwise at this point will only serve to confuse people.
-- Stan
participants (4)
-
Alexander Chekalin
-
Stan Hoeppner
-
Timo Sirainen
-
William Blunn