Monday, June 7, 2010

A Good Old Dog

The Mutt MUA started in 1995 when Michael Elkins wrote the first version. It's powerful, light-weight, made for CLI, and tends to suck less than do other email clients. It's my MUA of choice, and if you've never used it (or haven't in a while), you may want to give it a try. For the purposes of this little tutorial, I am going to assume that you use Gmail (who doesn't these days?). Another thing, Mutt has many more configuration options than those I will present here, I encourage you to look through the reference and explore more.

Installation
Most distributions have pre-compiled Mutt binaries available. It's part of the default Slackware installation, and as such I didn't need to grab it. If you use Ubuntu/Debian you can simply "$sudo apt-get install mutt postfix" and a few seconds later you are ready to go. In openSUSE, you should be able to find it with zypper, and for everyone else out there you can get packages or source at the mutt.org downloads page.

Differences
Mutt is an MUA (mail user agent), and not really an E-Mail client in the sense to which you are most likely accustomed. Unlike Pine (which comes with Pico built into it) and unlike any graphical E-Mail client, Mutt cannot handle much on its own. This results in the usage of other applications to create messages, and in many cases to view attachments. It also means that the sending/receiving of mail is usually done through outside applications. If you use IMAP (Gmail can use IMAP) and SMTP (again, Gmail can use SMTP) you are ready to rock without sendmail/getmail.

Setting Up Your Account
Fist, let's create our ~/.muttrc file. In your favorite VTE type "nano ~/.muttrc" and we will begin.


# SENDING MAIL
set copy=yes
set smtp_url="smtp://janedoe@smtp.gmail.com:587/"
set smtp_pass="password"
set from="janedoe@gmail.com"
set realname="Jane Doe"


For security reasons, you may elect to not enter your password here. The .muttrc file is plain text, and it would be fairly easy for someone to steal your password. If you do not enter it here, you will be prompted for it at every start of Mutt.


# RECEIVING MAIL
set imap_user="janedoe@gmail.com"
set imap_pass="password"
set folder="imaps://imap.gmail.com:993"
set spoolfile="imaps://imap.gmail.com/INBOX"
set record="imaps://imap.gmail.com/Sent"
set postponed="imaps://imap.gmail.com/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

# LOCAL FOLDER
set mbox_type=Maildir
set folder=~/Mail

# READING MAIL
set timeout=10
set mail_check=10
set sort=threads
set sort_aux=reverse-date-received
set move=no
set mark_old=no

# COMPOSING MAIL
set editor=nano #you can use any editor you choose
set markers=no
set signature=~/.sig #you can specify a signature but it's optional
set include=yes
set forward_format="Fwd: %s"

# VIEWING ATTACHMENTS
set mailcap_path=~/.mailcap
auto_view text/html


The mailcap file is important for viewing images and pdfs and other things. We can set it up now, and if you would like to look further into mailcap settings Gary Johnson has a good explanation at his mutt page.


text/html; echo && /usr/bin/w3m -dump %s; nametemplate=%s.html; copiousoutput
application/pdf; /usr/bin/evince %s
image/jpg; /usr/bin/display %s
image/gif; /usr/bin/display %s
image/jpeg; /usr/bin/display %s
image/png; /usr/bin/display %s


And there you are! You are all set up to use Mutt for your emailing. Using mutt, mcabber, lynx/links, and cmus you can pretty much kiss your mouse good bye. In GNOME, I maximize those four (one per desktop) and ctl+alt+(right arrow/left arrow) can take me across the four applications. Typically, I use DWM though. Hope you found it fun, hope you found it useful.

EDIT:
With the way this is set up, an MTA is not needed. Mutt automatically can do IMAP and SMTP now.

1 comments:

Chilly said...

Thanks for the article...it's been a while since I've used mutt...I forgot how much I loved it. Some of us get so used to trying out the latest and greatest, that we forget what we actually enjoyed using.

Post a Comment