Power Up Your E-Mail with Mutt
E-mail—one of the Internet's first joys and evils. It brings us closer but forces us to weed through clutter, distractions and snake oil salesmen. Parsing and organizing the data is a tricky task. As with most jobs tricky and time-consuming, people marry a favorite tool. Presumably, you have an e-mail reader you hold dear to your heart. Nevertheless, I suggest you cheat on Thunderbird, Evolution or KMail for a day and experience the power of Mutt, the e-mail client underdog.
Mutt is a feature-rich, lightweight, text-based e-mail client. Yes, it's text-based. Don't let Mutt's simple presentation fool you. The text-based display is a feature, providing a customizable, concise viewport. The Mutt e-mail client will play nicely with remote IMAP, POP3 and SMTP servers. SSL connections also are supported. Whatever features Mutt does not provide, other tools, such as address books, Web browsers, document viewers and more, can be leveraged to enhance Mutt's innate abilities. So, why all the fuss when most e-mail clients can do the same? Mutt is faster, more customizable and less resource-intensive.
Need to sort quickly through hundreds of e-mail messages a day? Find that your current e-mail client takes up too much screen real estate? Maybe your e-mail client consumes too much memory? Do you want better e-mail threading for all those mailing lists to which you belong? Are you a system administrator who regularly needs a quick way to test e-mail servers? Tired of dealing with your laptop's mouse pad to read and send e-mail? Want to use Vim or Emacs to compose your e-mail? If any of these apply, Mutt will seduce you.
The first obvious advantage of Mutt is its small memory footprint. Below, I show the memory usage of KMail, Thunderbird, Evolution and Mutt on my system:
VIRT RES SHR %MEM COMMAND 156m 37m 19m 3.7 thunderbird-bin 161m 33m 19m 3.3 evolution 96352 23m 17m 2.3 kmail 14548 6092 3180 0.6 mutt
Mutt uses only a fraction of the memory used by most popular e-mail clients. So, if you are using older hardware, Mutt may speed up your computer by freeing some memory. Either way, Mutt will not hog your system's resources.
Another advantage of Mutt is the text-based display. For one, the interface is highly customizable. All fields and colors can be changed to meet your demands. Color new e-mail messages green and deleted messages red. Produce pretty, threaded message views. Anything is possible.
Mutt has it all and through a shell, no less. No longer will you need to open up IMAP access to your private server. Instead, ssh into the server and run Mutt.
Before I go into Mutt's other features, let's configure Mutt, so you can take a test drive. In this article, I focus on how to configure Mutt to work with an IMAP server. For my examples, I use Gmail's IMAP service. Because Gmail is a public, freely available service, everyone should be able to follow along. If you have another IMAP server you want to use, change the settings from my examples to match your IMAP server's configuration. If you are using Gmail, make sure you enable IMAP access to your account in Gmail's Settings→Forwarding and POP/IMAP.
First, install Mutt. I recommend using Mutt 1.5.17 or newer. Features I discuss here, such as IMAP header caching, are not available in older Mutt releases. Chances are, your distribution has the latest and greatest. So, use yum, apt-get or compile the source code from www.mutt.org. If your custom binaries ever produce warnings about unknown features, check that you have all necessary options enabled in the compile's configure step.
Before running Mutt the first time, let's configure your IMAP connection. Create and edit a ~/.muttrc file, and add the following configuration options (make sure to fill in your account specifics):
set from="YOUR NAME <USER@gmail.com>" set imap_user=USER@gmail.com set imap_pass=PASS
This sets your From line and IMAP user login. If you are not comfortable with your password being in plain text on the filesystem, do not set imap_pass in your ~/.muttrc. If imap_pass is not set, you will be prompted for a password when you execute Mutt.
Next, set your folder, the default location of your mailboxes. You also might want to set the spoolfile to your Gmail Inbox, so that Mutt opens it automatically:
set folder=imaps://imap.gmail.com set spoolfile=imaps://imap.gmail.com/INBOX
Then, configure Mutt to save sent mail, or your record, into a Gmail folder named Sent. You also might want to configure a Draft, or postponed, folder:
set record=imaps://imap.gmail.com/Sent set postponed=imaps://imap.gmail.com/Drafts
Make sure to enable header caching, or Mutt will have to download all of your Inbox's headers upon each execution:
Finally, you need to configure smtp.gmail.com as your SMTP server. By default, Mutt delivers e-mail using /usr/sbin/sendmail -oem -oi. In your case, use Gmail's SMTP server so that the e-mail envelope looks legitimate. Otherwise, your message might be flagged as spam for not originating from gmail.com:
Again, leave out :PASS to increase security and enable a password prompt for each message sent.
Although these are the basics, the .muttrc file has the potential for a slew of options. Listing 1 is my entire .muttrc with some additional tweaks. Many of the options are just that, optional. The muttrc(5) man page explains them all, so be sure to give it a look.
- My Childhood in a Cigar Box
- Tech Tip: Really Simple HTTP Server with Python
- Papa's Got a Brand New NAS
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- Panther MPC, Inc.'s Panther Alpha
- Rogue Wave Software's TotalView for HPC and CodeDynamics
- Simplenote, Simply Awesome!
- Returning Values from Bash Functions
- Debugging Democracy
- NethServer: Linux without All That Linux Stuff