Setting up Dovecot IMAP services on Linux is fairly straightforward. There are quite a few decent tutorials out there, often with distribution specific details (for example Dovecot::Ubuntu). One of the decisions you must make during the setup process is what format to use for the mailboxes. The default format utilizes classic mbox files. Unfortunately these files don’t allow hierarchical structure. If you want to nest your mailboxes, you should select the Maildir format and follow the appropriate directions.
In (most?) situations, the default Maildir handling should work as expected. At least I would hope so, given that it is the default. In my situation, though, Apple/Mac Mail was stubbornly triggering server errors every time I tried to create folders or nested mailboxes, despite everything else working with Maildirs. It took quite a while to find the following setting in
/etc/dovecot/conf.d/10-mail.conf on Ubuntu 12.04 (though it should hold true for other Dovecot platforms as well):
mail_location = maildir:~/Maildir:LAYOUT=fs
:LAYOUT=fs part being the critical component. When that option is specified, Dovecot lays the Maildir out using actual subfolders on the server file system. As such, when Apple Mail sends the folder path with slashes in it, it understands the path.
Although there are some differences in folder names between the two types of Maildir, it seemed to be fairly safe to change from the default to the
fs layout. So if you have trouble with your mail client when creating or accessing subfolders, check your mail location setting.