[Dovecot] Custom Headers/Flags Support in dovecot

Timo Sirainen tss at iki.fi
Sun Mar 31 12:03:35 EEST 2013


On 30.3.2013, at 3.03, Ramesh Natarajan <ramesh25 at gmail.com> wrote:

> I am currently trying to evaluate if I can use dovecot to be used for my
> imap server like application. This is not an email application but a
> generic storage server that uses IMAP protocol to save and retrieve
> messages.
> 
> The messages have standard From/To/Date headers and a lot of custom headers
> for threading conversations e.t.c.  As a part of my application
> requirements I also need to support custom flags and have ability to
> set/change/retrieve them via IMAP.
> 
> 1) Does Dovecot support custom flags to be set/changed/retrieved?

Custom flags, yes. But note that they are intended to be just flags that are used by multiple messages, i.e. it's not a good idea to create new unique flags for different emails. I wouldn't be very comfortable in adding more than about 100 different flags (per folder), although Dovecot could probably handle thousands (by wasting memory and CPU unnecessarily).

> 2) I understand dovecot optimizes standard RFC822 headers and flags in
> cache/index files for faster lookups and searches. Does custom headers and
> flags fall into this optimization algorithm?

Dovecot adds to cache file those headers that are requested by the client. Initially nothing is cached (and nothing will be if client doesn't request them). So only IMAP FETCH[HEADER.FIELDS (..)] or FETCH ENVELOPE or SEARCH HEADER xx and such will add the header to cache file. Flags are always in the index file.

> 3) I am planning to support multiple users and each mailbox may have upto
> 1000 folders.  Each folder may have an average of  20 MIME encoded
> messages. I am planning to use local storage with single-dbox format. Do
> you see any issues with this?

You can only change headers by creating a new message and deleting the old one. Sounds like IMAP ANNOTATE extension is what you're really after, but Dovecot doesn't support that yet. Dovecot does have IMAP METADATA plugin though, which allows setting key=value pairs to folders. Dovecot v2.2 will maybe have that natively implemented as well. It might be possible to use that as a base for implementing ANNOTATE extension too..



More information about the dovecot mailing list