Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.
Mutt IS one of the best emailers around.
It's only disadvantage is that it is text based only, and that prevents many people from using it as their default email application. Mutt is however a very powerful 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.
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 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 muttprint-manual mutt-patched w3m
These applications are not covered in this howto, but manpages are available once installed.
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
Create ~/.muttrc in your preferred editor
First we have to tell mutt who you are, put the following in your .muttrc
set from = "firstname.lastname@example.org" 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 = "email@example.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.
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.
set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set trash = "imaps://imap.gmail.com/[Gmail]/Trash"
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
Here you would specify the url and password to gmail's SMTP server.
set smtp_url = "smtp://firstname.lastname@example.org:587/" set smtp_pass = "yourpassword"
The keybindings below shows mutt that pressing ie. “gi” (the letter g followed by the letter i) means “go to inbox”.
bind editor <space> noop macro index gi "<change-folder>=INBOX<enter>" "Go to inbox" macro index ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail" macro index gs "<change-folder>=[Gmail]/Sent Mail<enter>" "Go to Sent Mail" macro index gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
Don't put spaces between
the folder name as Mutt will complain that it cannot find the mailbox.
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
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
* Added by griffen76
If you get large volumes of email, say from newsletters and the like, you can easily sort them in mutt with the following added to your .muttrc:
group -group adverts -rx (email@example.com|Annoing@firstname.lastname@example.orgemail@example.comfirstname.lastname@example.org) fcc-save-hook "%f adverts" "+[Gmail]/adverts"
The above will allow you from the Index view in mutt to hit: