Address lookup in Mutt with mu

Mutt is a great little email client. I’ve been using it on a daily basis since ca. 2007, and have never looked back.

Somehow every time I talk about Mutt with someone who doesn’t know the program, we end up discussing the things it doesn’t do. Many things that people expect from an “email program”, Mutt simply leaves to external programs of the user’s choice. Which happens to be how I like it. This leaves Mutt to concentrate on what really counts: Processing large amounts of email quickly, effectively and with a minimum of pain.

One of the many things Mutt doesn’t do is looking up addresses of your contacts. You can have an external program do that via the query_command variable.The default keybinding for the query command in Mutt is “Q”.

I have just started to use the mu mail indexer (as part of a project to better integrate Mutt with org-mode, of which more some other time.) It has a great little command called “mu cfind”, which returns contacts matching a string. Getting Mutt to use this is really easy. Just put this in your .muttrc:

# looking up addresses with mu cfind
set query_command=”mu cfind ‘%s'”

UPDATE: This sometimes causes problems, see comments. This below works:

# looking up addresses with mu cfind
set query_command=”mu cfind –format=mutt-ab  ‘%s'”

Reload the config (or just restart Mutt), and you’re done. Now you can press Q to search for addresses.