HOWTO: Mutt
Posted: Thu Sep 05, 2013 10:45 am
..._____ __ __
/ \ __ ___/ |__/ |_
/ \ / \| | \ __\ __\ A guide to getting started with the Mutt
/ Y \ | /| | | | E-Mail Client.
\____|__ /____/ |__| |__|
\/
-Todo:
* Emacs specific options
* VIM specific options
* Using GPG
* Mutt-patched
* Theming Mutt
===============================================================================
INTRO ^
===============================================================================
When Ray Tomlinson sent the first email from one DEC-10 to another DEC-10
in 1971, the world was about to become a very different and way more
exciting place.
Email has been with us ever since. It may have been pushed a bit into the
background to make room for text messaging, social network communication
and microblog services, but email is still going strong.
When you want to send an email, you have to use a client of some
sort. There are a lot to choose from, but if you want to cut away the
cruft and just get the job done, there's no better option than a text
based one.
Mutt is such a client, and it impresses by doing one thing slightly less
than most other clients out there, namely...
Sucking.
This guide will take you through the installation of Mutt, the basic setup
for IMAP (in this case, Gmail) and a selection of configuration tweaks
that makes life just a little bit easier.
Based on feedback, I will expand this guide further in the future.
===============================================================================
CONTENTS ^
===============================================================================
INTRO (You just came from there)
CONTENTS (You are here)
INSTALLATION (APT-GET IT)
BASIC SETUP (Say hi to Gmail)
CUSTOMIZE (Making it better)
RESOURCES ()
ABOUT (About the author)
LICENSE (Because we all need one)
===============================================================================
INSTALLATION ^ APT-GET IT
===============================================================================
Before you can get any emailing done, you have to get Mutt installed.
~% apt-get install mutt
What? You expected more?
Most (if not all) current GNU/Linux distros have Mutt sitting in their
repositories. Replace 'apt-get install' with your equivalent emerge,
portage, yum, pacman (or whatever you use) command.
===============================================================================
BASIC SETUP ^ SAY HI TO GMAIL
===============================================================================
Every part of Mutt is configured with an .rc file, namely .muttrc
~% touch ~/.muttrc
Open .muttrc with your favorite editor, and let's start putting a few
basics in there.
################################
# IMAP + SMTP + NAME information
################################
set imap_user = "[email protected]"
set imap_pass = "YourPassword"
set smtp_url = "smtp://[email protected]:587/"
set smtp_pass = "YourPassword"
set from = "[email protected]"
set realname = "Your Name"
################################
The above should be fairly self explanatory, but we're basically telling
Mutt what credentials to use when authenticating with the IMAP and SMTP
protocol, as well as telling it what our name is.
Replace UserName with your Google account username
Replace YourPassword with your Google account password.
Replace Your Name with your real name, or whatever you like.
If you are using 2-step verification with Google, be sure to create an
application password for Mutt.
Go to https://security.google.com/settings/security for details.
Once you've figured out that password business, it's time to move on to
the next bit for the basic configuration.
###########################
# SETTING SENSIBLE DEFAULTS
###########################
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[GMail]/Drafts"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
###########################
Here we're telling Mutt where to find the mail folders, which folder to
open by default, where to put drafts, how often to check for new mail and
so on. You should never have to change these defaults.
As with the previous settings we put in .muttrc, every configuration
option is self explanatory.
imap_check_subscribed tells mutt to automatically check for new mail.
With those two chunks of configuration settings, you can start using mutt,
and be merry. But, we can't stop there.
===============================================================================
CUSTOMIZE ^ MAKING IT BETTER
===============================================================================
When working with IMAP folders, it's always nice to be able to navigate
around in them quickly, so let's make some macros to make that easier, as
well as making message archiving and deletion a breeze.
########################
# MACROS FOR GMAIL TASKS
########################
macro index,pager y "<enter-command>unset trash\n <delete-message>" "Gmail archive message"
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n <delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All<quote-char> Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
########################
Each macro is set with a keybinding followed by a string of commands and
the name for the macro.
When checking email, I find it helpful that the newest emails are the ones
at the top of the pile. Also, most of the time, they're part of an ongoing
conversation. So I like my mail sorted as such.
##################################
# SORTING BY THREADS, NEWEST FIRST
##################################
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
##################################
Here we set the sorting to be done by threads and make sure the newest
ones go to the top.
An email will contain a lot of header information, most of which we don't
really care about. So let's get rid of that.
###############################
# HIDE MOST OF THE EMAIL HEADER
###############################
ignore *
unignore from: date subject to cc
unignore x-mailing-list: posted-to:
unignore x-mailer:
hdr_order Date From To Cc
###############################
We start by ignoring everything, followed by a group of exceptions. After
that we tell Mutt in which order we'd like to see the header information.
Finally there's a pile of settings that I don't really want to put in a
section of their own, because they really aren't related to anything, but
still nice to have.
########################
# MISCELLANEOUS SETTINGS
########################
set markers = no # We don't need an indicator to see that a line is wrapped
set pager_index_lines = 5 # A mini index to tell us where we're at in the mailbox folder when reading emails
set header_cache=~/.mutt/cache/headers # Cache headers for faster access
set message_cachedir=~/.mutt/cache/bodies # Cache bodies for faster access
set certificate_file=~/.mutt/certificates # Tell Mutt where to save certs
set move = no # Don't move messages after reading them
set include # Include original message in reply
set auto_tag = yes # Because it just makes sense
unset record # With Gmail all mail goes to the same place
alternative_order text/plain text/html * # We'd like to see plain text before anything else
auto_view text/html # Use lynx/links/etc. to dump html to text
########################
===============================================================================
RESOURCES ^ ALL THINGS MUTT
===============================================================================
Mutt [ http://www.mutt.org/ ]
Mutt Manual [ http://www.mutt.org/doc/manual.txt ]