Dec 31
Free Software 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 have to add the default namespace
# which is normally NOT added explicitly before
#
namespace private {
  prefix =
  separator = /
  # the next line is very specific to where you keep your mail
  location = mbox:~/Mail/:INBOX=/var/mail/%u
  list = yes
  inbox = yes
  subscriptions = yes
  hidden = no
}

#
# Then add the virtual namespace
#
namespace private {
    prefix = virtual/
    separator = /
    # pick where the virtual folders will be
    location = virtual:~/Mail/virtual
    list = yes
    inbox = no
    subscriptions = yes
    hidden = no
}
 


You must also add the virtual folder plugin.

##
## IMAP specific settings
##

protocol imap {

  # ... you need to enable the plugin
  mail_plugins = virtual
 


Now restart dovecot and check your normal folders are working.

/etc/init.d/dovecot restart
 
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.


# ~/Mail/virtual/inbox-todo/dovecot-virtual
INBOX
  OR (OR (OR KEYWORD $TODO KEYWORD todo) KEYWORD $label4) unseen
 
which shows all unseen and mail labelled todo in my inbox and

# ~/Mail/virtual/inbox-important/dovecot-virtual
INBOX
  OR (OR KEYWORD $IMPORTANT KEYWORD important) KEYWORD $label1
 
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.

Posted by Colin Turner

Defined tags for this entry: , , ,
Bookmark Virtual folders with Dovecot and Debian  at del.icio.us Digg Virtual folders with Dovecot and Debian Mixx Virtual folders with Dovecot and Debian Bloglines Virtual folders with Dovecot and Debian Technorati Virtual folders with Dovecot and Debian Fark this: Virtual folders with Dovecot and Debian Bookmark Virtual folders with Dovecot and Debian  at YahooMyWeb Bookmark Virtual folders with Dovecot and Debian  at Furl.net Bookmark Virtual folders with Dovecot and Debian  at reddit.com Bookmark Virtual folders with Dovecot and Debian  at blinklist.com Bookmark Virtual folders with Dovecot and Debian  at Spurl.net Bookmark Virtual folders with Dovecot and Debian  at NewsVine Bookmark Virtual folders with Dovecot and Debian  at Simpy.com Bookmark Virtual folders with Dovecot and Debian  at blogmarks Bookmark Virtual folders with Dovecot and Debian  with wists Bookmark Virtual folders with Dovecot and Debian  at Ma.gnolia.com wong it! Bookmark using any bookmark manager! Stumble It!