I'm trying to setup virtual mailboxes. Not virtual user accounts, but rather virtual folders IN the user account.

This is to achieve better management of incoming mail. Somewhat like Gmail does with it's labels.

This is supposed to be super easy to enable. Just add a namespace

namespace virtual {
  prefix = virtual.
  separator = .
  location = virtual:~/Maildir/virtual:LAYOUT=maildir++

then add the mailbox to the namespace

namespace virtual {
  mailbox "All mail" {
    special_use = \All
    auto = subscribe
    comment = All my messages

and enabling the virtual plugin mail_plugins = $mail_plugins virtual

This is all fine but I get an error in the logs

Error: Failed to autocreate mailbox virtual.All Mail: Can't create virtual mailboxes

I don't understand why and can't find anything on that issue.

My guess would be a permission issue, but then again the virtual directory located at ~/Maildir/virtual is created but it's the ~/Maildir/virtual.All mail that seems to be having issues.

If it's a permission thing, where should I check? What should I be modifying in the configuration?

Thanks for your help


Ok, I still need help understanding this. But I managed to get something going on thanks to this mailing list message

It seems that even if the LAYOUT is maildir++ you need to structure your virtual folders under virtual/All, virtual/Work etc., structure ( which is the default LAYOUT=fs for virtual folders. BUT, you have to reference them with the . notation which is maildir++ structure throughout the configuration files.

Either I don't understand something or this is a bug.

Another weird behaviour, is that I can't seem to get anything else than virtual:~/Maildir/virtual to work. Meaning if I want to name the virtual folder something else than virtual it doesn't seem to be picked up by the mail client.

Finally, I was under the impression that if you putted list = children and hidden = true under your namespace, you wouldn't see the actual virtual folder as a parent in your mail client, but only the child virtual folders. Ok, I guess that rereading the docs, if you hide the namespace, no child will be listed. But what's the purpose of hiding namespaces if we can't access them?


I forgot to mention that Dovecot doesn't create the virtual folders if it doesn't exist even with auto = subscribe is set. It will show it if I create it from the command line. Which is a pain to do!

So if anyone can shed some light here, on any part of this (rather long) question, it would be much appreciated.


My guess is that you are missing dovecot-virtual file. You have to provide instructions to Dovecot on how to select messages for your virtual folder in this special file. In your case, the correct location of this file is probably ~/Maildir/virtual."All mail".dovecot-virtual.

The reason I am saying probably is that I am not sure that Dovecot and your file system will correctly handle the whitespace character in the path to this file. I would suggest starting with a name for your virtual folder that does not contain the whitespace character, for example: Allmail. Once everything is configured properly, you can change Allmail to "All mail" and see if the whitespace character breaks things or not.

The content of your dovecot-virtual file should be something like this:


or if you want to exclude certain folders like Trash, Spam and Junk, you can use something like this:


For more information on how to configure dovecot-virtual file and virtual folders generally, see the Dovecot Wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.