How to use recoll to index maildir folders

by Martin Monperrus

The Recoll desktop search tool can be used to index a maildir directory, for instance that comes from Thunderbird when the maildir format has been activated – user_pref("mail.server.server2.storeContractID", "@mozilla.org/msgstore/maildirstore;1");).

Here is how.

Configuration

  1. Create a specific configuration for your directory. Indeed, it is easier and recommended to have several different configurations, see Multiple indexes.

    mkdir $HOME/.recoll-maildir touch $HOME/.recoll-maildir/recoll.conf

  2. Set-up recoll.conf.

    topdirs = ~/.maildir/ indexallfilenames = 0 usesystemfilecommand = 0 processwebqueue = 0

That’s it. Recoll automatically detects that it is a maildir directory containing emails in cur, new and tmp.

Indexing

Simply run recollindex -c $HOME/.recoll-maildir.

Querying

Use recoll.

In menu Preferences >> External index dialog, add $HOME/.recoll-maildir/xapiandb as index location.

Then, add a Recoll helper script to open the emails in your favorite email client, say Thunderbird.

  1. In Preferences >> GUI configuration >> User Interface >> Choose editor applications, untick Use desktop preferences by default (because xdg-open is bad at opening extensionless emails in maildir directories).

  2. In Preferences >> GUI configuration >> User Interface >> Choose editor applications, for Mime type message/rfc/822, add a link to a script, eg. /home/martin/bin/recoll-thunderbird-open-file %f.

  3. In recoll-thunderbird-open-file:

    #!/bin/sh cp 1/tmp/.emlthunderbird − file/tmp/$.eml

Tagged as: