User Tools

Site Tools


mutt_configuration_and_basic_use

Mutt_Configuration_and_Basic_Use

Introduction

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.

Requirements

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.

Configuration

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 bl 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.

If you do not already have Mutt get it as you would any standard package, e.g.

sudo apt-get install mutt

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.

Encrypting your PW. Make a text file named ~/.mutt.pass and put in GMail: "your gmail PW" with out the quotes around your password and note the tab after the GMail:. Save it, encrypt it and give the encrypted file 700 permissions, and then delete the unencrypted original

gp g -e ~/.mutt/.pass

chmod 700 ~/.mutt.pass.gpg
rm ~/.mutt/.pass

*(the encrypt command may require more structure for some users)

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 if you prefer, 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 what ever 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.

  1. If you want to save an address from a message in any of your mailbox folders just press a when on the message and follow prompts till you type y to accept

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.

most people use urlview which is in standard repos to open links in their email when using mutt.

sudo apt-get install urlview

It should just work in Vinux4.

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.

Basic Usage

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.

  1. Type mutt in a console to start the program. I find mutt much more usable with speakup than it is in a gnome terminal with Orca.

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.

  1. Use up and down arrows to navigate through the list of messages and enter to open one for reading. Use review keys to read message contents and the space bar to go to next page.
  2. To reply type r. To reply to many mailing lists you will need to use shift l "L", but some mailing lists, e.g. vinux-support and other Googlegroups, configure their headers so that r replies to the list. - To return to the message list from a message you are reading press i.
  1. The m key is used to start writing a message. You are asked if you want to continue working on an already started message. If you type y you will be put in to a drafts folder. Other wise you are prompted for who to send the message to and the subject, and then your chosen editor opens to write the message body.

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.

  • The c key opens a change w mailbox folder dialog…
  • Shift c "C" is used to open copy options. The dollar sign "$" syncs your current folder with the remote server deleting flagged messages and such.
  • You will be asked to confirm before messages are deleted.
  • Quit the program with q.
  • When quitting or changing folders you will also be asked if you wish to delete marked messages. Markings are NOT saved when you leave a folder, close mutt, or if your connection times out.

* 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.

  • Use the "?" key to bring up help , and check the top of the screen for some basic commands for where you re in Mutt. When editing your editor will use its normal commands and keystrokes.

The Attachments Menu

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.

Multimedia files and other mime types

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.

Conclusion

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 configurattion and usage are welcomed. Please post on the Vinux-support list, or email me privately at

Wiki es_vinux@vinuxproject.org

Websites to learn more about how mutt works, its use, and configuration

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 sight, 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

Sample files for download

mutt_configuration_and_basic_use.txt · Last modified: 2015/04/28 23:43 by Burt Henry