More tools for Mutt 🔗

Posted by Médéric Ribreux 🗓 In blog/Sysadmin/

#sysadmin #email #mutt

Contact addressbook

Yesterday, I found that by using Mutt, I was lacking a solution to keep my contacts informations ! In muttrc, you can add aliases for your contacts but you don't have the choice: aliases are only for email addresses and names, not for phone numbers, addresses, URLs, etc… As those informations are not kept in Mutt configuration file (muttrc), I finaly found that I only got those data on papers scattered everywhere at home or even at work. It is just an easy solution to loose everything !

So, I just wanted a very light, text-mode way to keep those informations near me. And I found a pretty good one: abook. It is a ncurses interface to keep contact informations on a text file and it integrates very well with Mutt. Mutt can use it as an aliases provider. After a small aptitude install abook and a first launch of the software (type abook on the prompt: it shows an empty database), I started to import my mutt aliases with the following command:

abook --convert --informat mutt --infile .muttrc --outformat abook --outfile .abook/addresses

Then you have to modify your .muttrc by adding:

set query_command = "abook --mutt-query '%s'"

And it goes OK ! Mutt can use abook to find aliases and you can use abook text interface to add phone numbers, addresses, URLs, nickname, etc… Even if abook is not very well documented, its usage is trivial. The Debian Maintainer of this packet has documented a bit this light but clever software.

Mutt with local mailing-lists archives

You know that Mutt deals very well with mailing-lists. You can subscribe to them and use Mutt to sort, search and separate the messages by mailing-list. But Mutt starts to work only when you have subscribed. There is nothing for the old messages before your subscription.

I had to dig the openstreemap french mailing-list to find all the projects people were involved in since the beginning of the discussions. I could do it with the web: I can consult each message from the mailing-list web server. But it is really hard because there is no real search tool (only what google found) and you have to click for each message !

So here is a light method (not so clever) to use Mutt to do this job. Some mailing-lists servers put text archives of the messages. By downloading and concatenate them you can produce an mbox file that can be read with Mutt.

Here is a list of commands that do the job:

# download the whole mailing-list archives
wget -r -l 1 -nd -A *.gz

# Concatenate them to produce a big mbox file and remove
# the anonymisation ( at is replaced by @), otherwise Mutt
# cannot recognise the messages. Do a iso8859-15 to utf-8
# convert in order to read special chars
for f in $(ls |sort); do zcat $f | iconv -f iso8859-15 -t utf-8 | sed 's/ at /@/' >> Inbox; done

# Modify your mutt configuration to add this mailbox
# For example, if your file is in ~/ml/Inbox add
# mailboxes ~/ml/Inbox in your .muttrc file

Now, you can use Mutt to read,sort, search the mailing list archive…