When using IMAP with Dovecot, and Dovecot using MBOX to store the mails, working with subfolders can be awkward to say the least.
As there isn’t much to be found in one place about this, I thought I’d write a small blog about it.
The MBOX format limits your clients to creating subfolders that can either store folders, or emails, not both. When creating a folder, you differentiate between a folder for storing folders or for storing emails by adding or leaving out a forward slash at the end of the folder name: A folder name like ‘withsubfolders/’ will be able to store folders, a folder name like ‘onlyemails’ will only be able to store emails. If you try to create a subfolder in a folder that has been created without the forward slash you will get the nice error “Target mailbox doesn’t allow inferior mailboxes”.
A nice problem this limitation causes is when deleting folders in Microsoft Outlook you encounter the problem that the ‘removed items’ folder has been created to store only mails, so it will not be able to store deleted folders. You will get the ‘inferior mailboxes’ error from the previous paragraph. You can however work around this by pressing shift when trying to delete a folder, which will delete it immediately.