puzzling.org · mary.gardiner.id.au

Mutt configuration

If you're just learning the Mutt mail client, I'd suggest exploring My First Mutt and Telsa's .muttrc. On the other hand, for proficient users and .muttrc fiddlers, the manual is excellent.

My sane .muttrc defaults

Fix mutt's annoying default tenedency to automatically abort any message you didn't edit:

set abort_unmodified = no # or ask-no

Don't move read messages to ~/mbox, what the hell kind of idea is that!

set move = no

Store a copy of outgoing mail in the "sent-mail" mailbox:

set record = "=sent-mail"

Alternatively, you can store it in a monthly folder:

set record = "=sent-mail-`date '+%Y-%m'`"

Here are three editor alternatives to choose from. I use vim, but people converting from pine may prefer pico or nano (a Free Software pic clone).

set editor = "vim +/^$ ++1"
set editor = "pico -r 72"
set editor = "nano -r 72"

Viewing HTML mail

This command will dump HTML mail straight into your mutt window, just like ordinary text mail. And it will be quoted in your reply!

auto_view text/html

You might need to add some stuff to your .mailcap file, but this normally works fairly well without needing to set up your own mailcaps.

Setting the From: address based on the alias (folder solution)

Assume you have an email address me@example.com, and a whole series of aliases me-whatever@example.com, me-example@example.com, and so on, which is not uncommon.

All mail to me-whatever@example.com goes into your auto.whatever folder, mail to me-example@example.com goes into your auto.example folder. (See my procmail rules for a method of doing this.)

When in these folders, you want your From: address to be set to the alias.

We call out to a script from ~/.muttrc:

folder-hook . my_hdr From: My Name <me@example.com> # set the default header
`~/.mutt-minus.sh` # call the script to generate the others

The reason that the ~/.muttrc calls an external script is that although you can backtick commands in .muttrc files, it only takes the first line of the output. source however, reads a whole file in (thanks to Crossfire for that idea).

The script .mutt-minus.sh looks like:

#!/bin/sh
ls ~/Mail/auto.* | sed -e "s/.*auto\.\(.*\)/folder-hook auto.\\1 my_hdr From: My Name <me-\\1@example.com>/g" > ~/.mutt-minus
echo "source ~/.mutt-minus"

Colors and transperant terminals

mutt's background is black by default, to see whatever pretty background my terminal has "through" mutt, my .muttrc has these lines for color:

color normal    white default
color attachment brightyellow default
color hdrdefault cyan default
color indicator default cyan
color markers   brightred default
color quoted    green default
color signature cyan default
color status    brightgreen blue
color tilde     blue default
color tree      red default
color body     brightred default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
color body     brightblue default (https?|ftp)://[\-\.\,/%~_:?\#a-zA-Z0-9]+

color quoted1 brightyellow default
color quoted2 red default
color hdrdefault cyan default
color header   brightred default ^Subject:
color header   brightgreen default ^From:
color signature cyan default

color index green default ~p  # To me
color index brightyellow default ~N  # New

color index blue default ~T # Tagged
color index red default ~D # Deleted

As a bonus, these also highlight some headers, and URLs and email addresses embedded in my mail.

Last modified: 03 May 2003