For those of you that use Maildir mailboxes, you may find this tool useful:

mairix is a program for indexing and searching email messages stored in Maildir or MH folders.

  • Indexing is fast. It runs incrementally on new messages - any particular message only gets scanned once in the lifetime of the index file.
  • The search mode populates a “virtual” maildir (or MH) folder with symlinks which point to the real messages. This folder can be opened as usual in your mail program.
  • The search mode is very fast.
  • Indexing and searching works on the basis of words. The index file tabulates which words occur in which parts (particular headers + body) of which messages.
This is pretty handy. I have been trying to decide on a convenient way to store archived mail in a way that is easily searchable. (I thought about a SQL database briefly.) I currently store mail in archives by month, which made searching difficult until now. Now in mutt, I just can do “ ssh mailserver mairix invoice” to search for all messages containing “invoice”, and then hit F12, which I have bound to change to the folder containing the results.

Pretty handy.