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

