====== Mutt with Gmail/IMAP ======
"All mail clients suck. This one just sucks less." Michael Elkins, ca. 1995
{{http://avalon.gnuzifer.de/~heipei/linux/images/mutt.png|This is mutt}}
===== Introduction =====
Mutt IS one of the best emailers around.
It's only disadvantage is that it is textbased only, and that prevents many people from using it as their default email application.
Mutt is however a very powerfull email client with many features that are not included in other GUI emailclients.
This guide is focused on getting mutt up and running with your Gmail provider through its IMAP API and provides some keybindings to make the daily use easier.\\
We will look at how to recieve and sending email with mutt.
===== What mutt is NOT =====
Mutt is a Mail User Agent (MUA), and was written to view mail. It was not written to retrieve, send, or filter mail. It relies on external programs to do those tasks. But recently it has become possible to recieve and sending mails trough gmail.
===== Download and installation =====
Download and install mutt with this command
sudo apt-get install mutt
\\
Additional applications that might be worth trying is urlview and muttprint, these are not associated with gmail though.
sudo apt-get install urlview muttprint
These applications are not covered in this howto, but manpages are available once installed.
====== Configuration ======
Normally the default settings are fine to start with.
If you want to alter something, just put it in the configuration file that controls it all **~/.muttrc**.
You can find the syntax for these configurations in the muttguide: http://wiki.mutt.org/index.cgi?MuttGuide
===== Setting up IMAP =====
Create ~/.muttrc in your preferred editor
$EDITOR ~/.muttrc
First we have to tell mutt who you are, put the following in your .muttrc
set from = "yourusername@gmail.com"
set realname = "Your Real Name"
Then mutt has to know where your gmail mailbox is and what your password is.
You can safely put your password in here, we will cover this later.
set imap_user = "yourusername@gmail.com"
set imap_pass = "yourpassword"
Remember when running mutt for the first time, a certificate will be downloaded and you will be asked if you want to keep it.
Just type **Yes**.
===== Setting up folders =====
The following lets mutt recognize your gmail folders (labels) and your local folders. Remember that sent messages goes to your Sent Mail folder on the gmail server pr. default, so no actions needs to be done here.
=== Remote folders ===
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed ="+[Gmail]/Drafts"
set trash = "imaps://imap.gmail.com/[Gmail]/Trash"
=== Local folders ===
Paste this in your ~/.muttrc
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates
Now, create the 2 folders, the 3 lines above are referred to
mkdir .mutt
mkdir .mutt/cache
===== Setting up SMTP =====
Here you would specify the url and password to gmail's SMTP server.
set smtp_url = "smtp://yourusername@smtp.gmail.com:587/"
set smtp_pass = "yourpassword"
===== Special keybindings =====
The keybindings below shows mutt that pressing ie. "gi" (the letter g followed by the letter i) means "go to inbox".
bind editor noop
macro index gi "=INBOX" "Go to inbox"
macro index ga "=[Gmail]/All Mail" "Go to all mail"
macro index gs "=[Gmail]/Sent Mail" "Go to Sent Mail"
macro index gd "=[Gmail]/Drafts" "Go to drafts"
Don't put spaces between the folder name as Mutt will complain that it cannot find the mailbox.
===== Secure your muttsession =====
These lines will help you preventing some minor annoyances.
set move = no #Stop asking to "move read messages to mbox"!
set imap_keepalive = 900
Now save the file .muttrc in your /home directory.
To be sure that only your username can access the file you'll have to give the file a proper permission.
Type this in your terminal
chmod 700 .muttrc
===== Some extra stuff =====
This is parts from my .muttrc (just to get you going).
Please read the muttguide: http://wiki.mutt.org/index.cgi?MuttGuide for explanations!
# Header stuff
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
ignore *
unignore from: date subject to cc
unignore x-mailing-list: posted-to:
unignore x-mailer:
# For better looks
set markers=no # don't put '+' at the beginning of wrapped lines
set pager_index_lines= 5 # how large is the index window?
set sort = 'threads'
set sort_aux = 'last-date-received'
# My Editor
set editor='vim + -c "set textwidth=72" -c "set wrap" -c "set nocp" -c "?^$"'
# My Rolodeck :)
set alias_file= ~/.mutt/aliases
set sort_alias= alias
set reverse_alias=yes
source $alias_file
===== Customizing Mutt =====
Guides to get you started with using and customizing mutt :
* [[http://wiki.mutt.org/index.cgi?MuttGuide|The MuttGuide]]
* [[http://mutt.blackfish.org.uk/|My first mutt]] (maintained by Bruno Postle)
* [[http://www.therandymon.com/woodnotes/mutt/using-mutt.html|The Woodnotes Guide to the Mutt Email Client]] (maintained by Randall Wood)