Virtual mailboxes
=================

(This plugin is available with dovecot version 1.2.x only)

Namespace configuration
-----------------------

First you'll have to create a <namespace> [Namespaces.txt] for the virtual
mailboxes, for example:

---%<-------------------------------------------------------------------------
﻿namespace private {
  prefix = virtual/
  separator = /
  location = virtual:~/Maildir/virtual
}
---%<-------------------------------------------------------------------------

After this you can create virtual mailboxes under '~/Maildir/virtual'. By
default it uses the "fs" layout, so you can create directories such as:

 * INBOX: '~/Maildir/virtual/INBOX/'
 * Sub/mailbox: '~/Maildir/virtual/Sub/mailbox/'

If you prefer to use Maildir++ layout instead, you can simply append
':LAYOUT=maildir++' to the location.

Virtual mailbox configuration
-----------------------------

For each virtual directory you need to create a 'dovecot-virtual' file. Its
syntax is like:

---%<-------------------------------------------------------------------------
<1+ mailbox patterns>
  <search program>
[<more mailbox patterns>
  <search program for these mailboxes>
[etc..]]
---%<-------------------------------------------------------------------------

Mailbox patterns can contain IMAP LIST-compatible "*" and "%" wildcards. They
are currently evaluated only when the virtual mailbox is being selected, so if
more mailboxes are created during that they aren't noticed.

"*" wildcard matches only one namespace at a time based on the namespace
prefix. For example if you have namespaces with an empty prefix and a prefix
"mail/":

 * '*' matches only mailboxes from the namespace with empty prefix
 * 'mail*' matches mailboxes beginning with name "mail" from the namespace with
   empty prefix
 * 'mail/*' matches only mailboxes from the mail/ namespace

It's possible to give negative matches for mailbox names by prefixing the
mailbox name with '-' character.

Search program is compatible with IMAP SEARCH command. Besides the standard
SEARCH key you may want to use X-MAILBOX key which matches the message's
original mailbox.

Examples
--------

List all messages with \Deleted flag in all mailboxes:

---%<-------------------------------------------------------------------------
# ~/Maildir/virtual/Trash/dovecot-virtual
*
  deleted
---%<-------------------------------------------------------------------------

List all unseen INBOX and work/* messages:

---%<-------------------------------------------------------------------------
# ~/Maildir/virtual/unseen/dovecot-virtual
INBOX
work/*
  unseen
---%<-------------------------------------------------------------------------

Create a GMail-style "conversation view" for INBOX which shows all threads that
have messages in INBOX, but shows all messages in the thread regardless of in
what mailbox they physically exist in:

---%<-------------------------------------------------------------------------
﻿# ~/Maildir/virtual/all/dovecot-virtual
﻿*
  all
---%<-------------------------------------------------------------------------

---%<-------------------------------------------------------------------------
# ~/Maildir/virtual/INBOX/dovecot-virtual
﻿virtual/all
﻿ inthread x-references2 x-mailbox INBOX
---%<-------------------------------------------------------------------------

Create a mailbox containing messages from all mailboxes except Trash and its
children:

---%<-------------------------------------------------------------------------
# ~/Maildir/virtual/all/dovecot-virtual
﻿*
-Trash
-Trash/*
  all
---%<-------------------------------------------------------------------------

(This file was created from the wiki on 2009-01-07 04:42)
