Interfacing Recoll and Mutt

It is possible to either use Mutt as a Recoll search result viewer, or start Recoll from the Mutt search.

Starting Mutt to view Recoll search results

This method and the associated recoll2mutt script were kindly contributed by Morten Langlo.

This allows finding mail messages in recoll and then calling mutt or mutt-kz to read or process the mail.

Installation:

  • Copy the [[http://www.recoll.org/files/recoll2mutt|recoll2mutt script]] somewhere in your PATH, and make it executable.

  • In the recoll GUI menus: Preferences→GUI configuration→User interface→Choose editor applications change the entry for "message/rfc822" to: recoll2mutt %f

The script has options for setting a number of parameters, you may not need to set any of them, the defaults are:

  • -c mutt

  • -F .muttrc

  • -m Mail

  • -x "-fn 10*20 -geometry 115x40"

Example:

recoll2mutt -c mutt-kz -F .mutt_kzrc -m Mail -x "-fn 10*20 -geometry 115x40"  %f

The option -x is passed to xterm, which is used to call mutt or mutt-kz.

The script works for both mbox and maildir mail boxes, and it expects the configuration file for mutt and the mail directory to reside in your $HOME and the spool file to be /var/spool/mail/$USER if it is not in your mail directory. But it is easy to change the values in the script if you need to.

mutt is opened with the right mailbox and limit set to Date and Sender. In theory you could set limit to Message-Id, but very often mutt reports, that there are invalid patterns in Message-Id, so do it safe, even though all emails in the opened mail box with the same date from the sender are shown.

This will work only when using maildir storage (messages in individual files). It will not work with mailbox files. The latter would probably be possible by extracting the individual result messages using the Python interface, but I did not try.

The classic way to interface Mutt and a search application is to create a shortcut to an external command which creates a temporary Maildir containing the search results.

There is such a script for Recoll, you will find it here.

Copy the script somewhere in your PATH, and make it executable, then add the following line to your .muttrc:

macro index S "<enter-command>unset wait_key<enter><shell-escape>mutt-recoll.py -G<enter><change-folder-readonly>~/.cache/mutt_results<enter>" \
          "search mail (using recoll)"

Obviously, you can replace the S letter with whatever will suit you (e.g:/)