[Dovecot] Virtual mailboxes

Timo Sirainen tss at iki.fi
Fri Mar 14 12:21:47 EET 2008


Virtual mailbox support can be tested with:

hg clone http://hg.dovecot.org/dovecot-virtualboxes/

The code is still pretty non-optimized and I've only done some small
tests, but at least it appears to work. Messages can't yet saved to
virtual mailboxes, but I was thinking that the first configured mailbox
could be used as the save destination.

Configuration goes like:

mail_plugins = virtual
namespace private {
  ..
  prefix = virtual/
  location = virtual:~/virtual-boxes
}

~/virtual-boxes then contains a filesystem-layout view of all virtual
mailboxes. Virtual mailboxes are configured in "dovecot-virtual" files.
For example for virtual/unseen you'd create
~/virtual-boxes/unseen/dovecot-virtual file:

INBOX
Other mailbox
 unseen

So the format goes like:
<mailbox name>
[<more mailbox names>]
 <search rule>
 [<search rule continues>]

[<another mailbox name>]
 [<another mailbox's search rule>]

Currently mailbox name wildcards aren't supported. The search rules are
defined in exactly the same way as IMAP SEARCH command. So a few
examples:

 - all
 - unseen
 - or keyword $Label1 or keyword $Label2 $Label3
 - from domain.org subject hello

Each time the mailbox is synchronized the mailbox search is ran for all
the configured mailboxes. For simple rules this should be pretty fast,
but for e.g. body searches it's a bad idea. I'll fix this in future so
that it'll do searches only for newly seen messages.

Virtual mailboxes don't have dovecot.index.cache files. All mail
accesses (except uid/flag/keyword) go through the real mailbox and its
cache file is used/updated.

Messages that no longer match the search rule aren't removed until
mailbox is either reopened or EXPUNGE command is sent. This allows
creating a virtual mailbox with unseen messages, but without the message
getting lost immediately after it's opened. Although perhaps it would be
useful for a virtual mailbox with only non-deleted messages .. Maybe I
should make it configurable separately for each vmailbox.

I guess that's all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080314/4c95d8fe/attachment.bin 


More information about the dovecot mailing list