mail clients suck. This one [mutt] just sucks less.” Michael Eakins, ca. 1995 Even if you are not a big command-line user I recommend giving Mutt a try. While there are no menus to scroll through the program is easy to use. You select messages and mailbox folders from lists and perform actions on them using configurable keystrokes. I use ten or twelve intuitive keystrokes for most of what I do in mutt, *including handling encryption. Actually one does use some more keybindings when writing email, but as you use the editor of your choice you already know these. If you don't like a keybinding, change it, (try that with your favorite GUI email client), and you can make macros for custom commands, as simple or complex as you want. For hackers and those who need to do complex searches mutt adds some special keywords to standard regular expression syntax that can greatly simplify email filtering, etc.
The only thing absolutely required is a basic installation of the mutt mail user agent, MUA. For best results you will need the gpg package which comes on most if not all GNU-Linux distros, and a public/private key pair you want to use to handle encryption and signing. Urlview is recommended to pass links to a browser of your choice, and a well configured command line text editor that you like will be used to write mail.
Mutt is in most if not all Linux repose, and versions are available for most other Unix derivatives, and is installed on a high percentage of Linux boxes that you will run across. This guide is specifically designed to configure Mutt to work directly with GMail imap in a convenient and secure manner, but with minor edits it will work with other popular services such as Yahoo. You will be able to store your gmail password in an encrypted form as well as digitally sign and encrypt your email. Incoming encrypted messages are decrypted automatically, outgoing mail is digitally signed in clear text, and if you reply to an encrypted message your reply is encrypted by default. Two well tested example muttrc files are provided. example mutt configuration file an example mutt configuration file with extra functionality
Please pay attention to the comments and wording of actual settings in the sample muttrc files as they will help you understand behavior and configuration options. * Important: don't forget to name which ever file you use muttrc, muttrc.ext will not be recognized&used by mutt. Hidden file .muttrc will also be recognized.
Before final installation you will see a list of possible configurations. Fortunately we don't even have to understand these as for our set-up we can keep the default which is called do not configure, do nothing or something to this effect. You can reconfigure later if you want to set up your own mail server, MDA, or in some way significantly change your email provider.
The muttrc file can either be put in to your home directory as a hidden file, ~/.muttrc or if like me you quickly accumulate too many loose files and don't like the clutter put it in your .mutt folder, i.e. ~/.mutt/muttrc where you will put your encrypted password file. I use ~/.mutt/.pass for this which is turned in to ~/.mutt/.pass.gpg when encrypted.
STEPS FOR INSTALLATION.
Step 1 Install mutt.
If you do not already have Mutt get it as you would any standard package, e.g.
sudo apt-get install mutt
Step 2 Encrypting Your Gmail Password.
Step 2.1 Make a folder called ~/.mutt in your home directory, we will put the mutt configuration files there. We will now create ~/.mutt if it doesn't exist and change directory into that folder.
cd mkdir ~/.mutt cd ~/.mutt
Step 2.2 We will make a text file named ~/.mutt/mutt.pass by editing it with our editor (such as nano) and put in this file, exactly this Gmail: followed by no spaces, but by the TAB key then by your Gmail password. GMail: yourgmailpassword for this text file we do not use quotation marks inside the file as we will do in the muttrc file later, note that after "GMail: we insert the TAB character. The steps to follow to do this are below. The TAB key is put into the code below, so you can copy that and paste it into the mutt.pass file.
Put in this file:
REMEMBERING that after GMail there is only one TAB key and no spaces at all.
Save this file, and exit your editor.
Step 2.3 Now encrypt it by using gpg which will create a new encrypted file named ~/.mutt/mutt.pass.gpg and we use chmod to give this encrypted file 700 permissions, and then delete the unencrypted original file which we created above (~/.mutt/mutt.pass)
gpg -e ~/.mutt/mutt.pass chmod 700 ~/.mutt/mutt.pass.gpg rm ~/.mutt/mutt.pass
*(the encrypt command may require more structure for some users)
We need to make a subfolder in ~/.mutt called .tmp.
Most people use urlview which is in standard repos to open links in their email when using mutt.
sudo apt-get install urlview
Put a mailcap file in your ~/.mutt folder.
Here is a simple mailcap file, save as mailcap and put in ~/.mutt folder. MAILCAP FILE (goes in your ~/.mutt folder) a good sample mailcap file
It should just work in Vinux4.
I will leave lines in the sample muttrc file that will allow a user to use their GMail password in plain text, not encrypted, but I do not recommend this unless for some reason you are having trouble with gpg, or just need to get mutt up & running really fast until you have time to finish configuration.
If you are not interested in encrypting, decrypting or digitally signing any mail you can comment out all the lines in the encryption section. Mutt recognizes the typical "#" numbersign as the comment sign and everything following it on a line is not used by the program.
There are enough English words to explain more or less what most of the encryption lines do, so you can selectively comment out automatic signing or replying to encrypted mail in kind while leaving pgp functionality available via the pgp menu accessed with p when in the send mail menu where you can edit to and from fields, attach files or change subject lines.
Conversely you'll need to uncomment a couple lines to use plaintext PW.
Notice that I have nano set as my editor, just change this to whatever you like.
* Tip: For best results with speech I have soft wrap turned on in my /etc/nanorc file.
* Tip: You must have the 0X prepended to your key_ID in lines that deal with encryption commands, in the signing line note that the ID is used alone.
There are some keyboard shortcuts to change to standard gmail folders. I seldom use them, because I have a slightly more complex set of folders and labels, but they can be quite handy.
If you create new mail folders they will be synced by gmail. Just type shift c "C" and either press enter if you like the location mutt offers, (it may need to be created and mutt will ask if you wish to do so), press the "?" questionmark for a list of existing folders in a tree if appropriate, tab once for an expanded list view, or type the name of an existing mailbox or one you want to make.
and enter to put it in the default location. I use a separate file for addresses in the sample muttrc instead of letting mutt default to saving addresses in the muttrc file itself.
Aside from the basic data necessary to inter-operate with GnuPG and automatically decrypt encrypted mail, the encryption section of the sample muttrc also tells Mutt to automatically digitally sign all outgoing messages in clear-text, to encrypt all encrypted mail to me as well (for storage in my 'sent' folder, and to cache my passphrase for five hours.
Mutt lets you create a few types of macros and special commands, enter special characters, and can be configured to work with a wide range of programs to do just about anything you want to do with your mail. You can do a very wide range of customization with your muttrc file, but most mutt defaults are good for me.
I do add some interesting extras in the muttrc.ext file. It uses a newer much easier to understand encryption system/syntax compared with the method used other sample muttrc here, and in most mutt encryption how-tos.
Also the muttrc.ext file should work on most other distros with no modification. The older muttrc file may require minor changes to work on distros other than Vinux and Ubuntu spins.
The mutt manual is quite extensive. It is mostly quite clear, but some sections may require more study. In my sample muttrc file I configure f1 to open it in the lynx browser for easy navigation. If you don't have or don't like lynx change to a text-based browser you have and like. There are plenty of good, bad and indifferent howtos an tutorials online, so I'll only list the most essential starter keystrokes here.
Using the set-up explained in this article as soon as mutt opens you will be prompted for your pgp key's pass phrase. If entered correctly you will then see info about your key and then mutt will open your inbox. * Use speakup in cursoring on mode, or highlight tracking will usually work as well.
When you are finished do what ever you normally do to exit the editor saving messages, and they use y to send. You can also edit header info, add attachments or spell check if you have set that up from here. For example s puts you in the subject field, t to to, and e reopens the msg body in your editor. Use p to open the pgp menu and change encryption and signing options. To send attachments just type a before sending your message and type the path to the file you wish to attach. Completion works here, so you can just type enough letters to not apply to more than one message and tab and the rest is filled in for you, or use the questionmark to open the email folders list, and once used local files and sub folders as well. .
Once your message has been sent you are put back in the message or message index list where you started. The following keystrokes can be used in either the pager, i.e. when you have a message open to read, or from the index, message list, as can the keystrokes to reply or start new messages. In a few cases behavior may slightly vary depending on whether you are in anopen message or not.
* To delete an individual message type d, to delete the whole conversation use ^d. If you screw up and want to undelete use u or ^u to undelete a message or conversation respectively.
* You can also quit mutt with ^c with out being asked if you want to delete marked messages. This keystroke is also useful to abort many tasks. Just answer no when asked if you really want to quit mutt and you will be returned to the message or list you were in in these cases.
* Tag messages to apply the same action to them with t, and them use C to copy, s to save, (it's more like move as messages are marked for deletion, or just deleted when the s is used), or r to reply to them all at once.
Mutt has an attachments menu where not only are files you normally think of as attachments are listed. All parts of the email including signiture files and the message body itself appear in the list. In some cases three different files contain the main contents of the email, i.e. the body of the email. This is done to accomidate a wide range of email clients that have different cababilities, and may or may not comply with recognized standards. Typically in these cases you will have a multipart/alternative, plain/text, and text/html. When the message body is displayed by the pager, i.e. when you enter on an email in the message index, the html version is chosen over the plaintext one if you use either of the sample configuration files linked to in this article. This behavior can be changed by uncommenting a clearly labeled line in the muttrc's. Note that even though html is prefered over plain text the pager shows a dump of the text from the html file. Exactly how this will look depends on your browser configuration, e.g. if you have the browser set to number links a number does appear by the link name in the text shown in the pager. You can not just click on the number to open the link however. One way to open links using urlview is mentioned above. Another method is explained in the following subsection.
* Press v to open the attachments menu either when the message is selected in the message index or when the message is open in the pager.
Pressing enter on a file shown in the attachments menu will open it if mutt knows what program you want to open it with and any options needed to make that program work. These asociations are defined in a file called mailcap. Mutt will look for a mailcap file in your ~/.mutt directory, your home folder, and finally in /etc. Except for the one in .mutt mailcap files may be used by other programs, e.g. the elinks browser can use a user's or a system wide mailcap file to deciding how to handle links to different content types.
If you want only to define how mutt will open files then put a mailcap file in ~/.mutt. You should have a file in /etc called mime.types where different classes of files are defined. Vinux and many other distros will have /etc/mime.types by default. To use this sample mailcap file on all mime types in it you will need, vlc-nox, antiword, elinks and or lynx, unrtf, docx2txt and fbi. The sample file lets you listen to most popular audio and some video file types, some audio and video streams, read microsoft word files and .rtf documents, etc. If you open an html file from the attachments menu you will be able to open any links as this is not a text dump of the content as you saw in the pager. There are plenty of articles online about mime types and mailcap files, and you probably can use the existing associations to show you how to create new lines for file types not yet included.
With a bit of practice I think you may find as I have that mutt is one of the faster, if not the fastest/most efficient accessible solution around for most email tasks.
More tips and tricks, for mutt configuration and usage are welcomed. Please post on the Vinux-support list, or email me privately at
Notes on Mutt - matloff has explanations of important commands that you may find clearer than the manual. http://heather.cs.ucdavis.edu/~matloff/Mutt/NotesMutt.NM.html
My first mutt is a very good site, and is often referenced in mutt related blogs, forum posts and articles. http://mutt.blackfish.org.uk/
The Woodnotes Guide to the Mutt Email Client has lots of good information presented in a well organized manner. http://www.therandymon.com/woodnotes/mutt/using-mutt.html
The Arch Linux Wiki has excellent documentation on mutt, including a minimal muttrc which can be used to get you up and running in minutes. It stores your Gmail password insecurely in plain text though.
The Arch Linux Wiki documentation on how to add mutt's addressbook, abook. https://wiki.archlinux.org/index.php/mutt#Abook
SIMPLE MUTTRC FILE example mutt configuration file
ADVANCED MUTTRC FILE WITH CUSTOMIZATIONS AND EXTRA FUNCTIONALITY a muttrc with more customizations and extra functionality
MAILCAP FILE (goes in your ~/.mutt folder) a good sample mailcap file
ALIAS SORTING SCRIPT a script to put mutt address aliases in alphabetical order
Burt Henry 2014/06/06 20:32