Using Mutt
		Jim Mock <[email protected]>
		
		Introduction
		Email is probably one of the most important reasons
		  to use a computer.  Millions of people use and rely on
		  email every day (I'm one of them, and chances are you
		  are too).  It allows us to keep in touch with friends
		  and family, interact with co-workers and customers,
		  and provides a quick method of communication without
		  actually having to speak to someone, either on the
		  phone or directly.
		Reading and replying to email takes up a large part of
		  my time, so having an MUA (mail user agent, a.k.a.,
		  mail client, a.k.a., mail reader) that is flexible and
		  extremely configurable makes life easier.  That's why
		  I chose mutt.  The
		  rest of this article will cover a little about mutt
		  itself, and the installation and some basic
		  configuration of the "mongrel of mail user agents".
		About Mutt
		Mutt is a small, fast, text-based mail reader for
		  UNIX systems.  Although it was written from scratch,
		  its interface was originally based heavily on ELM.
		  Certain things, such as the default keybindings, are
		  still reminiscent of ELM.  As development of mutt
		  continued, features from PINE and
		  MUSH were added.  The result was a "mutt", which is
		  where the name comes from.
		Some noteable features include:
		
		  - Color support 
- Threading 
- POP3 and IMAP support 
- MIME support (including RFC2047) 
- PGP support 
- Searching via regex 
- DSN (Delivery Status Notification) support 
- Extensive foreign language support 
There are, of course, many other features of mutt
		  that are useful, although listing all of them here is
		  somewhat impractical.
		In my opinion, Michael Elkins, the original author of
		  mutt hit the nail on the head with this quote from
		  1995:
		
		  "All mail clients suck.  This one just sucks
		    less."
		
		Installation
		If you have the ports
		  collection installed, you can do the
		  following:
		# cd /usr/ports/mail/mutt
# make install distclean
		You may want to look at
		  /usr/ports/mail/mutt/Makefile before
		  installing the port since there are various things you
		  can define during building.  I usually build mutt
		  against S-Lang
		  instead of ncurses (no real reason other than personal
		  preference), so I'd need to define that on the command
		  line like this:
		# make -DWITH_SLANG install distclean
		There are other knobs too, such as
		  WITH_SSL that you may or may not find
		  useful.
		If you'd prefer to install the package, you can do
		  that too:
		# pkg_add -r mutt
		Now that mutt is installed, let's look at the
		  configuration.
		Configuration
		Mutt is configured via two configuration files.
		  There is a default "system" Muttrc, which
		  is installed in /usr/local/etc on FreeBSD
		  systems, and a ~/.muttrc for custom user
		  configurations.  Keep in mind that the
		  .muttrc file isn't installed and that you
		  have to create it yourself.
		There are tons of configuration
		  variables that you can use to tweak just about
		  every aspect of mutt.  I'll go through some of the
		  more useful ones here.  See the link above to the mutt manual for
		  a complete list.
		The defaults are fine for most things.  However,
		  there are a few things that you'll want to check, such
		  as your editor, mail folder, and spool file.  I use
		  vim as my editor, so
		  I put the following line in my
		  ~/.muttrc:
		
set editor="vim +8 -c 'set tw=72 ft=mail' -c 'syntax off'"
		What this does is pretty simple.  +8 tells
		  vim to put the cursor on the 8th line (a line under
		  the Subject: header).  The -c 'set tw=72
		  ft=mail' line tells vim to set tab widths at 72
		  and tells vim the filetype is mail.  The -c
		  'syntax off' turns off the color syntaxing (I
		  don't like the syntaxing in mails).
		By default, mutt uses ~/Mail as your mail
		  folder.  Before using mutt, I had been using PINE, and
		  PINE uses ~/mail.  I got used to that, and
		  had mail already there which I wanted to keep, so I
		  set the following in my ~/.muttrc:
		set folder="~/mail"
		You'll also want to set the spoolfile
		  variable to the proper place.  Mine is
		  /var/spool/jim.  Depending on your MTA, it
		  might be something different (if you're using Maildir,
		  etc.).  The line in my ~/.muttrc looks like
		  this:
		set spoolfile="/var/mail/jim"
		Another important feature for me is mutt's ability to
		  sort by thread.  This makes managing lots a email a
		  breeze.  To sort by threads, set the following
		  variable:
		set sort=threads
		There are a ton of other configuration variables that
		  you can change.  You can configure everything from
		  colors to threading to multiple email addresses and
		  more.  You can even configure the keybindings, which
		  is useful if you're switching from another MUA, such as
		  PINE.  I use PINE-style keybindings since that's what
		  I'm used to.  Here's what my ~/.mutt.keybindings
		  file looks like:
		# emulate PINE's keybindings
macro index I "c!\n"
macro pager I "c!\n"
macro index i "g!\n"
bind index v display-message
bind index p previous-undeleted
bind index n next-undeleted
bind index ' ' next-page
bind index c mail
bind index g change-folder
bind index w search
bind index y print-message
bind index x sync-mailbox
bind index $ sort-mailbox
bind index a tag-prefix
bind index \; tag-entry
bind index r group-reply
bind index t reply
macro index z ltagged\r
bind pager p previous-undeleted
bind pager n next-undeleted
bind pager ' ' next-page
bind pager g change-folder
bind pager c mail
bind pager w search
bind pager y print-message
bind pager \n noop
bind pager <up> previous-line
bind pager <down> next-line
bind pager r group-reply
bind pager t reply
bind compose \cx send-message
		This makes inputting in mutt behave like PINE.
		  Ctrl-x sends mail, c starts a
		  new message, and so on.
		In order to use the above file, I include it from my
		  ~/.muttrc by adding the following line at
		  the top:
		source ~/.mutt.keybindings
		Another important and useful feature of mutt is that
		  it has built-in support for pgp and gpg (gnupg).  The
		  first thing you'll obviously need to do is install one
		  of the above.  I use gpg, so I installed
		  /usr/ports/security/gnupg:
		
# cd /usr/ports/security/gnupg && make install distclean
		You'll have to generate a gpg key and send it to a
		  keyserver for it to be useful.  See the gpg man page
		  and gnupg web site
		  for more information on doing that as it is beyond the
		  scope of this article.
		The next step is to tell mutt that you want to use
		  gpg.  Luckily, mutt comes with a gpg.rc,
		  which is installed by default in
		  /usr/local/share/doc/mutt/samples/gpg.rc.
		  I copied that to my home directory as
		  ~/.mutt.gpgrc and then included it in my
		  ~/.muttrc by adding the following to the
		  top of the file:
		source ~/.mutt.gpgrc
		In order to sign or encrypt a message (or both), do
		  the following:
		
		  - Compose a message as normal. 
- When you exit the message composition screen
		    and the next screen appears (you'll see the headers
		    and a list of attachments), hit the "p" key.  This
		    will give you the option of signing, encrypting,
		    doing both, or "forget it". 
- Choose the option you wish, enter your gpg
		    passphrase, and then send the message. 
For more information, see http://mutt.org/doc/PGP-Notes.txt.
		These are just a few of the many options available
		  when using mutt.  If you're interested in others, I
		  suggest taking a look at the mutt manual,
		  /usr/local/etc/Muttrc (the system-wide
		  muttrc), and the muttrc man page.  You can also find
		  my mutt configuration files on my web
		  site.  They will require some modification before
		  you can use them.  Use them at your own risk.  Just
		  because they work for me doesn't mean they'll work for
		  you.
		Conclusion
		Mutt is a highly configurable mail user agent.  You
		  can customize nearly every aspect of it.  You can find
		  it in the ports collection in the
		  /usr/ports/mail/mutt directory.  I suggest
		  giving it a try.  Perhaps you'll agree with Michael
		  Elkins' quote :-)
		- jim
		Return to
		  Issue 1, May 2001