2008-06-30

Mutt query_command for mail address

In mutt its possible to query external program for e-mail address. After typing some letters (in To: Cc: or Bcc:) press <Ctrl+T> and mutt calls external program defined in .muttrc in query_command variable (e.g. set query_command="~/.mutt/addgrep.sh '%s'").

It can be any program, and one is widely recommended: rolo.

Below is very short, basic script, but complex enough for me:

#!/bin/bash

if [[ $# < 1 ]]
then
exit
fi

echo 'Grepping ~/.mutt/address_book.txt...'
grep $1 ~/.mutt/address_book.txt


The structure of address book is as follow:

Anyname <mail@address.com>
First Sure <first_sure@address.org>
just@address.net
"All variants" <of_syntax@domain.com>

No comments: