Mutt

is Article description::a text-based, command-line mail user agent (MUA). mutt is one of the current console-based mail clients that's still under active development and has a vast crowd of active supporters (and users). It is powerful, highly customizable, small, and efficient.

neomutt is a fork of mutt which is very similar, to which most of this article also applies.

Introduction
While Mutt was originally designed to read mail from the local mbox mail spool (e.g. ), nowadays it comes with full support for Maildir stored folders, remote fetching from POP3 servers and complete management of IMAP accounts. For a full description of what Mutt can do, please read the Mutt manual.

Installation
Starting your Mutt adventure simply requires you to emerge it. Unfortunately, Mutt has a lots of options, which enable or disable certain functionalities of Mutt. We now briefly discuss the most important USE flags that you may want to enable based on your intended usage of Mutt. Please note that enabling most of them won't harm your Mutt, but may make it do more than an experienced Mutt user would like.

IMAP
The  USE flag is probably the most important feature to enable for Mutt. Enabling it only beneficial. Most email providers, even free ones such as Gmail, use IMAP, as it is the most convenient way to store email that is accessed from multiple clients at the same time and/or different locations. Because IMAP keeps all mail at the server, Mutt just downloads the messages that you want to view.

Header cache backends
Next to reading messages, it often happens that you will list a mailbox, to see what is in there. For this information, Mutt has to download the message headers. When you switch folders frequently, or your folders contain a large amount of emails, downloading the message headers over and over again will take some time. Since this simply is a waste, Mutt uses a so-called header cache (USE flag ) to keep the most important bits of messages that it needs to greatly speedup opening folders. This header cache is backed by a db-library, of which five flavours exist:,  ,  ,  , and. If you don't have any preference yourself, pick  as it is the fastest when used with Mutt. You can only enable at most one db-library USE flag for  backend. If you re-emerge Mutt with a different db-library later, Mutt will rebuild its caches automatically when it opens a folder.

Sending mail
While IMAP is important for reading mail, sending mail requires a mail server. Mutt can deliver mail using a local (send)mail submission, but often that's not a good solution for users that travel around (e.g. laptop users). Mutt comes with SMTP support which is enabled by default with the  USE flag. Mutt's SMTP support allows you to send mail over a mail server of your choice with the option to authenticate an account. This is usually an SMTP server given to you by the email provider.

Secure protocols
Both IMAP and SMTP protocols send data over encrypted channels. With the  and/or   USE flags enabled, it is  wise to enable the   or   USE flags. Both add the secure variants (imaps and smtps) to Mutt's list of supported protocols using either OpenSSL's or GNUTLS' implementation respectively. Most readers will not have a strong preference between OpenSSL and GNUTLS, so just go for, since it is most likely this is already in the system's global list of USE flags. When intending to authenticate when sending e-mail, be sure to also include the  USE flag. The  USE flag is required for authentication when sending email.

Encryption
Even with secure IMAPS and SMTPS protocols, it is best practice to sign and/or encrypt email messages. Mutt supports traditional OpenPGP and S/MIME. Both of these are supported using the gpgme wrapper. The easiest way to setup support for signed and encrypted messages is using the  USE flag. Documentation and experiences in this area can be confusing to say the least. When enabling  USE flag, ensure the backend has been properly setup in the configuration (see below).

Configuration
After you emerge Mutt with some choice USE flags, the only necessary next step is to create a file. muttrc's are to be found in many places on the web and in Mutt's documentation. In some muttrc samples from the official distribution can be found. A very minimal for an IMAP based account with SMTP mail delivery is shown below. It also enables signing emails via gpg using the gpgme backend.

.muttrc
The example above sets up an IMAP account, uses an SMTP server to send mail, stores its cache in, reads the known address aliases (think of it as an address book) from  and appends the signature from  when composing new mail. For some IMAP servers it may be necessary to change the spool, record and postponed directories, as the folders and  may be under a folder called. Simply trying this out with Mutt is the simplest way to figure this out.

Once the is setup, you are ready to launch Mutt by just running. If you entered a valid IMAP server URL, Mutt will prompt for a password and afterwards load all messages. Note that the first time entering your mailbox may take a while if you have quite some messages, since Mutt's header cache is still empty. If this succeeds you're in your IMAP mailbox ready to go.

Navigation is intuitive, as is reading messages by just pressing the key or  bar. Mutt is quite Vim alike in that it uses key strokes to perform most of its actions. You best read Mutt's manual to become familiar with all existing functions (or press in Mutt) and what key they are bound to, or better, what key you like it to be bound to. Some essential keys are (for message) to start composing a new message,  for quit,  for reply,  for save and  for print.

.mailcap
One of the features that Mutt has that is still not in today's most savvy email clients is the ability to display attachments inline through some viewer. The  directive in the  file tells Mutt which attachments (based on their MIME-type) it should view inline. To figure out how to do that, Mutt uses mailcap files to lookup how to display a certain MIME-type. Usually the system wide mailcap file isn't sufficient here, so you better start a file to put items in there for   that Mutt can display inline.

In the example above   is enabled for   and   files. These two show the extreme usefulness of this capability, because it means meeting notes sent as doc file now are perfectly fine readable without having to save the attachment and open it in LibreOffice. Instead the text just shows up in the message reader, that is, if you have a matching entry in your file.

The above example tells Mutt what to do to "view"   and   files. For the former it should run a program called (emerge  ), for the latter the program. You can go wild with these to for example display rendered HTML (give a try), render vcards, or show ASCII representation of attached images. All you need to do is define how to call the program in your, and tell Mutt to try to view it inline using the  directive.

Conclusions
Mutt is a very versatile console email client. If you like the concept, Mutt can be altered to behave in nearly any way through its configuration. Search the web to find others explaining how they did "it", or find one of the many patches that exist to make Mutt do even more. Gentoo applies a couple of very popular patches to Mutt, so make sure to check if you want something more to make sure it is not yet already at your disposal. While learning Mutt is not necessarily easy, once it is in your fingers, it can make your mail experience much faster and efficient than with other clients. Searching for example is quite powerful if you know how to hit the right flags and know which regular expression narrows your search down. Enjoy Mutting!