A plugin that automatically creates a virtual mailbox when a new keyword is set on a message.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CMakeLists.txt
FindDovecot.cmake
LICENSE
README.md
virtual-keywords-plugin.c
virtual-keywords-plugin.h

README.md

Dovecot Virtual Keywords Plugin

This plugin needs some testing.

This plugin will automatically create a virtual mailbox whenever a new keyword is set on a message. It will also create the dovecot-virtual file needed to map the new keyword onto a virtual mailbox:

Virtual.All
  keyword Important

On user login, it will also create the following default mailboxes if necessary:

  • All (all messages expect Trash)

    *
    -Trash
    -Trash/*
      all
    
  • Starred (all flagged messages)

    Virtual.All
      FLAGGED
    

Install

We use CMake. Make sure to install Dovecot headers before building.

mkdir build
cd build
cmake ..
make

Then copy libvirtual_keywords_plugin.so into Dovecot modules directory, usually /usr/lib/dovecot/modules.

Dovecot configuration

In order for this plugin to work, you need to configure a new namespace in Dovecot for hosting virtual mailboxes.

mail_plugins = $mail_plugins virtual notify virtual_keywords

namespace {
  type = private
  prefix = Virtual.
  separator = .
  location = virtual:~/Maildir/virtual
  list = yes
}

The plugin accepts the following parameters:

plugin {
  ...

  # namespace prefix where virtual storage is configured
  virtual_keywords_prefix = "Virtual."

  # excluded keywords (no default)
  virtual_keywords_exclude = "$MDNSent,\NonJunk,\Junk,\Recent,$Forwarded,\Answered,\Flagged,\Deleted,\Seen,\Draft"
}

TODO

  • When a keyword is set on a message, set the same keyword to all messages in that thread
  • Delete a virtual mailbox if there are no more messages with that keyword