Quite a bit of effort has been made to make Mutt the premier text-mode
MIME MUA. Every effort has been made to provide the functionality that
the discerning MIME user requires, and the conformance to the standards
wherever possible. When configuring Mutt for MIME, there are two extra
types of configuration files which Mutt uses. One is the
mime.types file, which contains the mapping of file extensions to
IANA MIME types. The other is the mailcap file, which specifies
the external commands to use for handling specific MIME types.
There are three areas/menus in Mutt which deal with MIME, they are the pager (while viewing a message), the attachment menu and the compose menu.
When you select a message from the index and view it in the pager, Mutt
decodes the message to a text representation. Mutt internally supports
a number of MIME types, including text/plain, text/enriched,
message/rfc822, and message/news. In addition, the export
controlled version of Mutt recognizes a variety of PGP MIME types,
including PGP/MIME and application/pgp.
Mutt will denote attachments with a couple lines describing them. These lines are of the form:
[-- Attachment #1: Description --]
[-- Type: text/plain, Encoding: 7bit, Size: 10000 --]
Where the Description is the description or filename given for the
attachment, and the Encoding is one of
7bit/8bit/quoted-printable/base64/binary.
If Mutt cannot deal with a MIME type, it will display a message like:
[-- image/gif is unsupported (use 'v' to view this part) --]
The default binding for view-attachments is `v', which displays the
attachment menu for a message. The attachment menu displays a list of
the attachments in a message. From the attachment menu, you can save,
print, pipe, delete, and view attachments. You can apply these
operations to a group of attachments at once, by tagging the attachments
and by using the ``tag-prefix'' operator. You can also reply to the
current message from this menu, and only the current attachment (or the
attachments tagged) will be quoted in your reply. You can view
attachments as text, or view them using the mailcap viewer definition.
See the help on the attachment menu for more information.
The compose menu is the menu you see before you send a message. It allows you to edit the recipient list, the subject, and other aspects of your message. It also contains a list of the attachments of your message, including the main body. From this menu, you can print, copy, filter, pipe, edit, compose, review, and rename an attachment or a list of tagged attachments. You can also modifying the attachment information, notably the type, encoding and description.
Attachments appear as follows:
- 1 [text/plain, 7bit, 1K] /tmp/mutt-euler-8082-0 <no description>
2 [applica/x-gunzip, base64, 422K] ~/src/mutt-0.85.tar.gz <no description>
The '-' denotes that Mutt will delete the file after sending the
message. It can be toggled with the toggle-unlink command
(default: u). The next field is the MIME content-type, and can be
changed with the edit-type command (default: ^T). The next field
is the encoding for the attachment, which allows a binary message to
be encoded for transmission on 7bit links. It can be changed with the
edit-encoding command (default: ^E). The next field is the size
of the attachment, rounded to kilobytes or megabytes. The next field
is the filename, which can be changed with the rename-file command
(default: R). The final field is the description of the attachment, and
can be changed with the edit-description command (default: d).
mime.types
When you add an attachment to your mail message, Mutt searches your
personal mime.types file at ${HOME}/.mime.types, and then
the system mime.types file at /usr/local/share/mutt/mime.types or
/etc/mime.types
The mime.types file consist of lines containing a MIME type and a space separated list of extensions. For example:
application/postscript ps eps
application/pgp pgp
audio/x-aiff aif aifc aiff
A sample mime.types file comes with the Mutt distribution, and
should contain most of the MIME types you are likely to use.
If Mutt can not determine the mime type by the extension of the file you
attach, it will look at the file. If the file is free of binary
information, Mutt will assume that the file is plain text, and mark it
as text/plain. If the file contains binary information, then Mutt will
mark it as application/octect-stream. You can change the MIME
type that Mutt assigns to an attachment by using the edit-type
command from the compose menu (default: ^T). When typing in the MIME
type, Mutt requires that major type be one of the 5 types: application,
text, image, video, or audio. If you attempt to use a different major
type, Mutt will abort the change.
mailcap
Mutt supports RFC 1524 MIME Configuration, in particular the Unix specific format specified in Appendix A of RFC 1524. This file format is commonly referred to as the mailcap format. Many MIME compliant programs utilize the mailcap format, allowing you to specify handling for all MIME types in one place for all programs. Programs known to use this format include Netscape, XMosaic, lynx and metamail.
In order to handle various MIME types that Mutt can not handle internally, Mutt parses a series of external configuration files to find an external handler. The default search string for these files is a colon delimited list set to
${HOME}/.mailcap:/usr/local/share/mutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap
where $HOME is your home directory.
In particular, the metamail distribution will install a mailcap file,
usually as /usr/local/etc/mailcap, which contains some baseline
entries.
A mailcap file consists of a series of lines which are comments, blank, or definitions.
A comment line consists of a # character followed by anything you want.
A blank line is blank.
A definition line consists of a content type, a view command, and any number of optional fields. Each field of a definition line is divided by a semicolon ';' character.
The content type is specified in the MIME standard type/subtype method.
For example,
text/plain, text/html, image/gif,
etc. In addition, the mailcap format includes two formats for
wildcards, one using the special '*' subtype, the other is the implicit
wild, where you only include the major type. For example, image/*, or
video, will match all image types and video types,
respectively.
The view command is a Unix command for viewing the type specified. There are two different types of commands supported. The default is to send the body of the MIME message to the command on stdin. You can change this behaviour by using %s as a parameter to your view command. This will cause Mutt to save the body of the MIME message to a temporary file, and then call the view command with the %s replaced by the name of the temporary file. In both cases, Mutt will turn over the terminal to the view program until the program quits, at which time Mutt will remove the temporary file if it exists.
So, in the simplest form, you can send a text/plain message to the external pager more on stdin:
text/plain; more
Or, you could send the message as a file:
text/plain; more %s
Perhaps you would like to use lynx to interactively view a text/html
message:
text/html; lynx %s
In this case, lynx does not support viewing a file from stdin, so you
must use the %s syntax.
Note: Some older versions of lynx contain a bug where they
will check the mailcap file for a viewer for text/html. They will find
the line which calls lynx, and run it. This causes lynx to continuously
spawn itself to view the object.
On the other hand, maybe you don't want to use lynx interactively, you just want to have it convert the text/html to text/plain, then you can use:
text/html; lynx -dump %s | more
Perhaps you wish to use lynx to view text/html files, and a pager on all other text formats, then you would use the following:
text/html; lynx %s
text/*; more
This is the simplest form of a mailcap file.
The interpretion of shell meta-characters embedded in MIME parameters can lead to security problems in general. Mutt tries to quote parameters in expansion of %s syntaxes properly, and avoids risky characters by substituting them, see the mailcap_sanitize variable.
Although mutt's procedures to invoke programs with mailcap seem to be
safe, there are other applications parsing mailcap, maybe taking less cour
P>If Mutt was compiled with SSL support (by running the configure
script with the --enable-ssl flag), connections to IMAP servers
can be encrypted. This naturally requires that the server supports
SSL encrypted connections. To access a folder with IMAP/SSL, you should
use {[username@]imapserver[:port]/ssl}path/to/folder as your
folder path.
Note that not all servers use / as the hierarchy separator. Mutt should correctly notice which separator is being used by the server and convert paths accordingly.
When browsing folders on an IMAP server, you can toggle whether to look at only the folders you are subscribed to, or all folders with the toggle-subscribed command. See also the $imap_list_subscribed variable.
Polling for new mail is more expensive over IMAP than locally. For this reason the frequency at which Mutt will check for mail remotely can be controlled by the $imap_checkinterval variable, which defaults to every 60 seconds.
Mutt is designed to work with IMAP4rev1 servers, and was originally tested with both the UWash IMAP server v11.241 and the Cyrus IMAP server v1.5.14. Nowadays it is primarily developed against UW-IMAP 12.250. It appears to work more-or-less correctly against Cyrus 1.6.11 as well.
Note that if you are using mbox as the mail store on UW servers prior to v12.250, the server has been reported to disconnect a client if another client selects the same folder.
As of version 1.2, mutt supports browsing mailboxes on an IMAP server. This is mostly the same as the local file browser, with the following differences:
enter by default)
will choose to descend into the subfolder view. If you wish to view
the messages in that folder, you must use view-file instead
(bound to space by default).delete-mailbox
command (bound to d by default. You may also
subscribe and unsubscribe to mailboxes (normally
these are bound to s and u, respectively).
Mutt supports three authentication methods with IMAP servers: GSSAPI, CRAM-MD5, and LOGIN (there is a patch by Grant Edwards to add NTLM authentication for you poor exchange users out there, but it has yet to be integrated into the main tree). Mutt will try whichever methods are available on the server, in order from most secure to least. That is, mutt will first try GSSAPI authentication (ie Kerberos V), then CRAM-MD5, and finally LOGIN (the worst possible choice - your password travels across the net in the clear).
There are a few variables which control authentication:
Note: The IMAP support has had very limited testing due to a lack of developers using it. It should work with the reference servers mentioned above, but if you need a more stable way to access your IMAP folder, consider using a specialized program, such as fetchmail.
If a message contains URLs (unified ressource locator = address in the WWW space like http://www.mutt.org/), it is efficient to get a menu with all the URLs and start a WWW browser on one of them. This functionality is provided by the external urlview program which can be retrieved at ftp://ftp.guug.de/pub/mutt/contrib/ and the configuration commands:
macro index \cb |urlview\n
macro pager \cb |urlview\n