Version française



Mutt is certainly the best mailer (more precisely, mail user agent) that exists under Unix. Here are some of its features...

Personally, I've been using Mutt since October 1996 (version 0.47).


Old Resources


Character Display

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.

Xterm and Copy-Paste

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 Use Emacs as your Editor...

Character Encoding

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> .*\\)+\\|$\\)")
      (search-forward "\n\n" nil t))


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))
          (goto-char (point-min))
           ((looking-at "^From:")  ;; Composed mail (new mail or reply).
           ((and (mutt-search-header "Content-Transfer-Encoding: 8bit")
            (let ((charset (intern (downcase (match-string 1)))))
              (if (memq charset (coding-system-list))
                    (message "Found charset %s in header." charset)
           (t 'undecided-unix))))

(modify-coding-system-alist 'file "/mutt-.*-[0-9]+-[0-9]+-[0-9]+\\'"

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


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: