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 escreen and sh.screen utilities. The escreen command (Perl script) is used by my smutt script described below: it is a GNU Screen wrapper to save the new environment (e.g. corresponding to the new graphic session) in a file. It must be used together with sh.screen, which is a wrapper to the shell (usually /bin/sh) used to execute a command; the goal of this wrapper is to retrieve the new environment. Thus a Screen session surviving to a graphic session change (either because the X server has restarted after a logout, or because the Screen session is resumed through a ssh) will still be able to launch graphic applications on the right screen.
Note: to be able to use the sh.screen wrapper, Mutt needs to be recompiled with the configure option --with-exec-shell=/path/to/sh.screen.
My smutt script, whose main feature is to start Mutt in a Screen session or recall the current Mutt Screen session if any. It uses the escreen wrapper (see above).
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.
Note: the feature to change the environment via an external file was already supported directly by an old version, originally written in February 2003, but was limited to the editor (for composing messages...), via my mutteditor script (see below).
My mutteditor script, a GNU Emacs wrapper, whose initial goal was to retrieve the environment saved by smutt so that the editor (for composing messages...) opens on the right screen. This script also replaces malformed data by a character representable in the current locale (this is necessary for Emacs) and removes 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).
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
(to load from your .emacs, with
(load "mutteditor" t)
for instance),
which contains this code, together with other useful things described
below.
To use this mutt-mailto script when clicking on a
mailto: link in Firefox
under GNU/Linux (and maybe other similar systems), open
the Applications tab of the preferences, and for the
mailto entry, choose Use other...
and
select the mutt-mailto script. There was another method,
which
no longer works: open the special URL
about:config and add (or modify) the preference
network.protocol-handler.app.mailto,
by giving the string mutt-mailto
as its value.
Note: since in fact Mutt supports mailto: URL's in argument (which was not documented), the mutt-mailto script could be simplified.
The sysdotlock patch, which provides a --with-system-dotlock configure option to choose an existing mutt_dotlock utility (already installed on the system).
I had written an initial --with-dotlock patch on 2002-07-29. The above patch is based on the one Tamotsu Takahashi wrote on 2005-02-03, which I updated.
My address_all_patt patch, which adds the pattern modifier ~a to match addresses in all headers with addresses taken into account by Mutt in its envelope structure: From:
, Sender:
, To:
, Cc:
, Bcc:
, Return-Path:
, Reply-To:
, Mail-Followup-To:
.
I wrote the initial patch on 2008-05-30 (old ticket 3065), which I updated.
The progress patch, providing an optional colored progress bar.
This is the patch Rocco Rutte wrote on 2009-03-17, with a correction I did on 2010-08-02.
My simplesearchkw patch to make simple search keywords
optional.
I wrote this patch on 2012-06-04 (old ticket 3586).
My pretty_size patch to improve the pretty size
display (bytes size display).
I wrote this patch on 2020-04-24 (old version, partly incorrect) and fixed it on 2024-07-10 (its behavior had to be changed).
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.
The Mutt repository now contains a similar feature, which will be available in Mutt 1.6. Cf changeset 5288:b68ccc2e66e2 and changeset 5293:daf29fe0ed4c.
For Mac OS X, I was using the url-mailto.el file (adapt it to your needs), replacing the file provided by Emacs 22.3; it needs gnuserv-compat.el and its dependency gnuserv.el (not provided by MacPorts, but these are old files you can find on the web, for instance). Early Emacs 22 versions had to use this older url-mailto.el file instead. Concerning the installation, it suffices that this file is found in the load-path before the official file. This does not work with Cocoa Emacs 23, and I do not have a solution yet.
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-hook (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.
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.
This section is obsolete.