About Mairix

Though I use Gnus, I also like tools which do one thing and one thing only. Mairix is a tool for indexing and searching words in locally stored mail. It was written by Richard Curnow and is licensed under the GPL. For more information visit

Unlike many existing tools it does support mail folders (mbox format) indexing! Though mairix might not be as flexible as other search tools like swish++ or namazu (see also: IndexMail), it has the prime advantage of being incredibly fast. From my experience, it can easily search through headers and message bodies of thousands and thousands of mails in well under a second. Building the database necessary for searching might take a minute or two, but only has to be done once fully. Afterwards, the updates are done incrementally and therefore are really fast, too. Additionally, Mairix is very easy to set up.

For maximum speed though, Mairix should be used with mails stored in Maildir or MH format (this includes the Gnus nnml back end), although it also works with mbox. Mairix presents the search results by populating a “virtual” maildir/MH folder with symlinks which point to the “real” message files (if mbox is used, copies are made).

Requirements for using nnmairix

Mairix searches local mail - that means, mairix absolutely must have direct access to your mail folders. If your mail resides on another server (e.g. an IMAP server) and you happen to have shell access, nnmairix supports running mairix remotely, e.g. via ssh.

Additionally, nnmairix only supports the following Gnus back ends: nnml, nnmaildir, and nnimap. You must use one of these back ends for using nnmairix. Other back ends, like nnmbox, nnfolder or nnmh, won’t work.


Main features of nnmairix:

Setting up nnmairix.el

nnmairix is now part of Gnus and is distributed with GNU Emacs 23.2.

You can find the documentation here:

For a quick overview, you can also access the current nnmairix docs at

Please note that this is only the nnmairix node and not the complete Gnus documentation, so references to other nodes don’t work.


mairix can cause problems with gnus and IMAP (e.g. if you have a local Dovecot server). If an email in your search results is subsequently moved from it’s original group to another group the filename will be changed. This means gnus wont be able to find it when you restart (it will still be listed under the original filename in the search group), and so gnus wont start (you will get an error message about not being able to find file). To fix this you will need to do the following things

  1. delete the mairix search dir (zz_search… or something like that) and database (mairix_database)
  2. run mairix again from the command line to recreate the database
  3. delete the mairix search group from your .newsrc /.newsrc.eld : search for “mairix” in the gnus-newsrc-alist definition and delete the corresponding group definition (i.e. the enclosing list).
  4. restart gnus
  5. recreate server and default group (press: G b c then choose nnmaildir for backend server)