Virtual folders with Dovecot and Debian

I use client side virtual folders a bit for my mail. Specifically, I tag messages with IMAP flags like todo and important, and then in Icedove / Thunderbird, I set up a special folder as a saved search which shows message that are either unseen, or marked todo in my inbox. It works rather well, and I use the same set-up on my laptop, and work and home desktop machines.

But it’s not very useful on my phone, which doesn’t allow such sophisticated client side behaviour. My phone mail applications shows the most recent 25 messages in a folder, but there are times when it would be really useful to look up messages that are labeled as important but rather old. It would be time consuming to look through the older messages, and difficult to find the one I want anyway.

As a result, I’ve been looking at the possibility of using virtual server side folders using dovecot on my Debian mail server. I was put off by the documentation which left a lot of questions unanswered.

Here’s how I did it on Debian. First of all edit the config file /etc/dovecot/dovecot.conf, back up this file first, so you can restore working behaviour if something goes wrong.

You must also add the virtual folder plugin.

Now restart dovecot and check your normal folders are working.

Note that I found dovecot will generally not serve physical folders correctly if the virtual mail folder (even if empty) does not exist. I consider this a bug, but one that needs to be worked around, at least for me.

If that’s all done and working you can begin to create virtual folders. I created two directories within my ~/Mail/virtual folders; which were inbox-todo and inbox-important respectively. Inside each I put the following files.

which shows all unseen and mail labelled todo in my inbox and

which shows only important mail in my inbox.

It seems to be working, my normal folders appear to be working perfectly correctly (but I’ll know better in a couple more hours/days); my phone has successfully subscribed to the two virtual folders, though the folder list shows a number of files which I’m certain it should not, again, this looks like a dovecot bug to be honest.

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *