Eric Radman : a Journal

Terminal-Based E-mail with Mutt

Basic Configuration

Set your name and e-mail address by creating ~/.muttrc and setting the from variable:

set from="Eric Radman <ericshane@eradman.com>"

Mutt can be set to use any text editor you like, simply edit .muttrc.

set editor="vim"

It's also possible to set specific options when VIM is started using this special syntax

set editor="vim +':set textwidth=78' +':set wrap'"

Mutt uses direct access to folders in your home folder by default, but it also has very good IMAP support

set imap_authenticators=&quot;login&quot;
set spoolfile=imap://localhost/
set folder=imap://localhost/
set imap_user=&quot;ericshane&quot;
set imap_pass=&quot;*****&quot;
set mail_check=&quot;360&quot;

If you'd like to save drafts and sent messages, specify a local folder to save them in

set postponed="$HOME/.maildir/.Postponed"
set record="$HOME/.maildir/.Sent"

Or specify an IMAP mailbox thusly

set record="=Sent Items"
set postponed="=Drafts"

You may also have to set you're primary inbox

set spoolfile = "+INBOX"

Navigation Keys

q   Quit
d   Mark to delete
u   Undelete
m   Start a new message
@   Show reply-address
v   Show attachments
s   Save to another folder
c   Change folders
C   Copy to folder
h   Show/hide full headers
$   Sync mailbox
;   Apply to all marked messages

Customization

The query_command is a nifty feature that lets you assign a script or program to the Q key to search for an address entry.

set query_command="grep -B 2 -C 4 -i -e '%s' ~/addresses.vcf |
  grep -e "FN:" -e "EMAIL:" -e "--" | awk -F ":" '{ print $2 }'"

Header display

ignore *
unignore X-Mailer date from subject to cc

MIME Types

Pressing v will show you the sections in an email

q:Exit  s:Save  |:Pipe  p:Print  ?:Help
  I     1 <no description>                       [text/html, base64, utf-8, 29K]

To customize the view edit .mailcap and enter a MIME type followed by the command to be used for viewing.

text/html; lynx -force_html %s

Mutt can also set this view in the preview window automatically

auto_view text/html

Also useful is print_command which can be used to teach mutt how or where to print.

set print_command="/usr/bin/lpr -Php5550"

Sorting

You can sort your mailbox with o key, and even enable threading with ot

Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore/s(p)am?:

To make this the default add the following to your .muttrc

set sort=threads
set sort_aux=date

References

A Quick Guide to Mutt by Scott Robbins

Learning Mutt

My dotfiles by Suvlekhim Takatz

Notes on Mutt by Michael Elkins

Mutt & Maildir Mini-HOWTO

Official Manual by Michael Elkins

$ 2011-03-21 08:05:06 -0500 $