Mutt is certainly the best mailer (more precisely, mail user agent) that exists under Unix. Here are some of its features...
First, it is a non-graphic mailer, that runs in a text terminal. This can be seen as a disadvantage by some people, but the interface is very good, making Mutt very pleasant to use, and this also has advantages: it is very fast, it can run remotely with a text connection (this is useful for some of us!) and several operations can be done in the graphic mode (by using an XWindow client): composing messages, reading messages (possibly occasionally), viewing attachments, etc.
Mutt completely supports the latest standards: MIME (encodings, attachments, character sets, PGP/MIME, DSN, etc), POP3, IMAP, multiple mailbox formats (mbox, MMDF, MH, maildir), etc.
Mutt is entirely customizable: macros can be written, any function or macro can be attached to any keyboard operation, header control when viewing or composing messages, powerful configuration for the page layout (index, colors), mail archiving and other functions.
Threading: Threads can be displayed in a reply-tree representation and missing messages can be detected. You can perform operations related to this tree.
Mutt has special functions for mailing-lists; in particular, the Mail-Followup-To pseudo-standard is supported.
Nested attachments are very well supported and displayed in a tree representation.
Despite all its features, Mutt uses little memory (its code is very clean) and very efficient. It can run on small configurations without any problem, like on the big ones, even with huge mailboxes.
Mutt is translated into more than 20 different languages.
Finally, Mutt is a free software (distributed under the GPL license).
Personally, I've been using Mutt since October 1996 (version 0.47).
Translation into French: fr.po file; this is the latest version, to be used with the latest development versions only.
My save history patch, for saving the history to a file, has been integrated into the Mutt repository and this feature will be available in Mutt 1.6. For those with an older Mutt version, here's the latest version of my patch. The history is controlled by the variables $history_file and $save_history (minimum size of the history in the file), and is stored in the UTF-8 encoding to have a consistent behavior if the user changes its locales. The first version dated from July 2002.
My time_inc patch, to prevent the progress information from being displayed too often (e.g. when one does a search on a large mailbox). Variables to control this progress information do exist, but they only allow the user to declare something like: display progress information every 10 processed messages. Since the average time to process a message can be very different from a context to another one, these variables are not sufficient: if one wants the progress information to be updated often enough (under any condition, like searching the message bodies), one needs a small value; but at the same time, this can slow down Mutt very much for the fastest operations (e.g. searching the message subjects), in particular if it is running on a remote host (e.g. via SSH). Thus this patch makes Mutt much faster under some conditions, without any drawback. I posted technical information and the patch to the mutt-dev mailing-list on 2006-11-22.
My smutt script, whose main feature is to start Mutt in a screen session or recall the current Mutt screen session if any. It also changes the environment so that the editor (for composing messages...) opens on the right display, via my mutteditor script. This mutteditor script also allows to replace malformed data by a character representable in the current locale (this is necessary for Emacs) and remove the control characters from U+007F to U+009F; to do this, the mkprintable script is used (put it in your ~/bin directory or modify the path in the mutteditor script).
The smutt script now uses a small script apptty, which disables some terminal features that are useless here and conflict with the use of Mutt in the present case.
My Perl script mutt-mailto, to be able to send an e-mail with Mutt from a mailto: URL, supplied to the script as an argument. When this script is executed from a terminal, Mutt is just launched in this terminal. Otherwise Mutt is launched in an Emacs window, which is used as a terminal; the reason is that I use Emacs as my editor, so that I can reuse the same window to compose the e-mail message.
For this, you will also need the emacs-mutt.el file (to be installed in a directory listed in the load-path Emacs variable), the mutteditor script already mentioned above, and the gnuclient utility. Moreover the mutteditor script contains (as a comment) some code to put in one's .emacs; otherwise use mutteditor.el, which contains this code, together with other useful things described below.
To use this mutt-mailto script when clicking on a mailto: link in Mozilla or Firefox, you can open the special URL about:config in your browser and add (or modify) the preference network.protocol-handler.app.mailto, by giving the string mutt-mailto as its value. Unfortunately, this does not work under Mac OS X.
For Mac OS X, I use the url-mailto.el file (adapt it to your needs). In the Mac OS X preferences (e.g. with RCDefaultApp), it suffices to choose Emacs as the e-mail application, and Mutt will automatically be executed in an Emacs window. I suppose that this also works with other web browsers. But there is a problem I have not managed to solve: if an Emacs window (more precisely, a frame) is present, it will be reused (instead of getting a new one), then automatically closed when Mutt is quit.
If your terminal is correctly configured, i.e. if the character encoding used by the terminal really corresponds to your locales, then there is theoretically nothing to configure on the Mutt side (but see below). Indeed, by default, the characters are automatically converted into the encoding specified by the locales, via the libiconv library. This behavior can be changed by specifying another encoding in the $charset variable.
If your terminal is configured to use a Unicode encoding (normally UTF-8), everything should be OK, except possible problems (such as missing fonts) not specific to Mutt. Otherwise it is possible that some characters to be displayed are not part of the local character set. For instance, it is the case of the Euro symbol (€) in ISO-8859-1, or more generally, of the right single quotation mark (’), used as an apostrophe by some users. When such a character cannot be converted or when the input string contains an invalid sequence, Mutt displays one or several replacement characters instead (in general, these are question marks). Alternatively, one may want to replace a character that is not representable in the local character set by an equivalent or similar character. This is called transliteration, which can be activated thanks to the //TRANSLIT suffix. Thus the right single quotation mark can be replaced by the accute accent character (´) or by the apostrophe character (') in a terminal using the ISO-8859-1 encoding.
To use transliteration with Mutt, it suffices to add the following line to your .muttrc file:
set charset=`locale charmap`//TRANSLIT
Under Mac OS X (Darwin), the locale charmap command unfortunately does not work (without even exiting with a nonzero error status), though it is defined by POSIX. Therefore I use the following line in my .muttrc file:
set charset=`codeset 2> /dev/null || locale charmap`//TRANSLIT
where the C source of the codeset command is the following: codeset.c.
Note: If you use Mutt in a screen session in UTF-8 on an ISO-8859 terminal, then the transliteration could only be done by screen (in a necessarily more limited way, to respect character alignment in the terminal), but screen does not seem to support transliteration and does not use libiconv.
If you use the xterm terminal, it is recommended to set the keepSelection X11 resource to true (you need xterm #230 or higher). This can be done permanently by adding the line
*keepSelection: true
to your $XAPPLRESDIR/XTerm file or
XTerm*keepSelection: true
to your .Xresources file (the various ways to set this option may depend on your system and your configuration). This option can also be found in the VT Options menu (which appears with Ctrl-middle-click), but this would affect only the current xterm window.
If you haven't done this yet, you must first fix the problems related to the character encoding (charset), in particular if your language contains non-ASCII characters (for instance due to diacritics, such as accents) or if you communicate with people whose name may contain such characters. When you need to compose a message (either a new message or a reply), Mutt launches the editor with (possibly empty) contents in an encoding specified by your environment (locales). When you quit the editor, the file containing the message must have the same encoding (which isn't necessarily the one that will be used when the message is sent by Mutt).
By default, Emacs is configured to use the encoding (coding system, in the Emacs jargon) specified by the locales. Therefore you do not have to do anything special. In case there is a clash with something else in your configuration, you can still put the following line in a find-file-hook in your .emacs file:
(prefer-coding-system locale-coding-system)
However this can lead to some problems if you need to edit messages with Mutt's edit-message function; in this case, the code given below is preferable, even if not perfect.
By default, the I/O are not configured correctly when Emacs is run in a text terminal (e.g. xterm). For this, you need to add to your .emacs:
(when (not window-system) (set-keyboard-coding-system locale-coding-system) (set-terminal-coding-system locale-coding-system) )
Moreover, if you have a signature file, it must also be in the encoding specified by the locales. If you use several locales (I do), you can convert the signature into the right encoding on the fly with iconv, by putting the right command in your .muttrc. For instance, to do a conversion from iso-8859-1:
set signature="iconv -f iso-8859-1 $HOME/.signature|"
Example of some Emacs LISP code to put the cursor after the possible header lines and remove any quoted signature when replying to messages (thanks to Ralf Fassel for his help):
(add-hook 'find-file-hooks (lambda ()
(when (string-match "^mutt-.*-[0-9]+-[0-9]+-[0-9]+$"
(file-name-nondirectory (buffer-file-name)))
(set (make-local-variable 'backup-inhibited) t)
;; The following code is executed only when composing messages
;; (new messages or replies), not when editing messages (which
;; start with "From ") from the mailbox.
(when (looking-at "^From:")
(flush-lines "^\\(> \n\\)*> -- \\(\\(\n> .*\\)+\\|$\\)")
(not-modified)
(search-forward "\n\n" nil t))
(mail-mode)
)))
Put this code in your .emacs file, possibly after adaptating it...
Another example, to correctly choose the coding system of the edited file:
(defun mutt-search-header (regexp)
(goto-char (point-min))
(while (not (or (eolp) (looking-at regexp)))
(forward-line 1))
(not (eolp))
)
(defun mutt-find-file-coding-system (arg-list)
"\
Determine the coding system of a mail file. Use the current locale if the
file doesn't declare a charset (in practice, when composing a mail message
instead of editing one). This is a heuristic."
(if (eq (car arg-list) 'insert-file-contents)
(let ((case-fold-search t))
(save-excursion
(goto-char (point-min))
(cond
((looking-at "^From:") ;; Composed mail (new mail or reply).
locale-coding-system)
((and (mutt-search-header "Content-Transfer-Encoding: 8bit")
(mutt-search-header
"Content-Type:.*charset=\"?\\([-0-9a-z]*\\)"))
(let ((charset (intern (downcase (match-string 1)))))
(if (memq charset (coding-system-list))
(progn
(message "Found charset %s in header." charset)
charset)
'undecided-unix)))
(t 'undecided-unix))))
'undecided-unix)
)
(modify-coding-system-alist 'file "/mutt-.*-[0-9]+-[0-9]+-[0-9]+\\'"
'mutt-find-file-coding-system)
This must be the locale coding system when composing a mail message
(either a new message or a reply). But when editing a message (thanks to
Mutt's edit-message function),
it should be the charset
of the message, when this makes sense
(messages with MIME attachments are not supported).
The Mutt official pages, where you can find documentation, the sites to download it, etc.
The wiki.
The dmoz links.
Here's my .muttrc (configuration file). It should no longer contain strictly private commands (such as the alternates commands). But it is wise to understand and adapt it to your needs before using it.
The list of the bugs I'm concerned with: