~ubuntu-branches/ubuntu/precise/mutt/precise

« back to all changes in this revision

Viewing changes to doc/mimesupport.html

  • Committer: Package Import Robot
  • Author(s): أحمد المحمودي (Ahmed El-Mahmoudy)
  • Date: 2010-12-17 14:28:28 UTC
  • mfrom: (16.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20101217142828-ve8yy0xf1zomtnx9
Tags: 1.5.21-1ubuntu1
* Merge with Debian experimental (LP: #691512), remaining changes:
  + debian/control, debian/patches/debian-specific/build_doc_adjustments.diff:
    Use w3m (main) instead of elinks (universe) for generating documentation.
  + Drop libtokyocabinet-dev (universe) from Build-Depends, use always
    libgdbm-dev and also use gdbm for the header cache backend. (lp: #607448)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
 
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Mutt's MIME Support</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><link rel="next" href="optionalfeatures.html" title="Chapter 6. Optional Features" /><style xmlns="" type="text/css">
 
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Mutt's MIME Support</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><link rel="next" href="optionalfeatures.html" title="Chapter 6. Optional Features" /><style xmlns="" type="text/css">
4
4
      body { margin-left:2%; margin-right:2%; font-family:serif; }
5
5
.toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
6
6
h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
22
22
div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
23
23
div.note h3:after { content: ":" }
24
24
div.note { margin-bottom: 5px; }
25
 
strong.command { font-family: monospace; font-weight: normal; }
 
25
.command { font-family: monospace; font-weight: normal; }
 
26
.command strong { font-weight: normal; }
26
27
tr { vertical-align: top; }
 
28
.comment { color:#707070; }
27
29
 
28
 
    </style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Mutt's MIME Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="advancedusage.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="optionalfeatures.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="mimesupport"></a>Chapter 5. Mutt's MIME Support</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="mimesupport.html#using-mime">1. Using MIME in Mutt</a></span></dt><dd><dl><dt><span class="sect2"><a href="mimesupport.html#mime-pager">1.1. Viewing MIME Messages in the Pager</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#attach-menu">1.2. The Attachment Menu</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#compose-menu">1.3. The Compose Menu</a></span></dt></dl></dd><dt><span class="sect1"><a href="mimesupport.html#mime-types">2. MIME Type Configuration with mime.types</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#mailcap">3. MIME Viewer Configuration with Mailcap</a></span></dt><dd><dl><dt><span class="sect2"><a href="mimesupport.html#mailcap-basics">3.1. The Basics of the Mailcap File</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#secure-mailcap">3.2. Secure Use of Mailcap</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#advanced-mailcap">3.3. Advanced Mailcap Usage</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#mailcap-example">3.4. Example Mailcap Files</a></span></dt></dl></dd><dt><span class="sect1"><a href="mimesupport.html#auto-view">4. MIME Autoview</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#alternative-order">5. MIME Multipart/Alternative</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#attachments">6. Attachment Searching and Counting</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#mime-lookup">7. MIME Lookup</a></span></dt></dl></div><p>
 
30
    </style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Mutt's MIME Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="advancedusage.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="optionalfeatures.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 5. Mutt's MIME Support"><div class="titlepage"><div><div><h2 class="title"><a id="mimesupport"></a>Chapter 5. Mutt's MIME Support</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="mimesupport.html#using-mime">1. Using MIME in Mutt</a></span></dt><dd><dl><dt><span class="sect2"><a href="mimesupport.html#mime-overview">1.1. MIME Overview</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#mime-pager">1.2. Viewing MIME Messages in the Pager</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#attach-menu">1.3. The Attachment Menu</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#compose-menu">1.4. The Compose Menu</a></span></dt></dl></dd><dt><span class="sect1"><a href="mimesupport.html#mime-types">2. MIME Type Configuration with <code class="literal">mime.types</code></a></span></dt><dt><span class="sect1"><a href="mimesupport.html#mailcap">3. MIME Viewer Configuration with Mailcap</a></span></dt><dd><dl><dt><span class="sect2"><a href="mimesupport.html#mailcap-basics">3.1. The Basics of the Mailcap File</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#secure-mailcap">3.2. Secure Use of Mailcap</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#advanced-mailcap">3.3. Advanced Mailcap Usage</a></span></dt><dt><span class="sect2"><a href="mimesupport.html#mailcap-example">3.4. Example Mailcap Files</a></span></dt></dl></dd><dt><span class="sect1"><a href="mimesupport.html#auto-view">4. MIME Autoview</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#alternative-order">5. MIME Multipart/Alternative</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#attachments">6. Attachment Searching and Counting</a></span></dt><dt><span class="sect1"><a href="mimesupport.html#mime-lookup">7. MIME Lookup</a></span></dt></dl></div><p>
29
31
Quite a bit of effort has been made to make Mutt the premier text-mode
30
32
MIME MUA.  Every effort has been made to provide the functionality that
31
33
the discerning MIME user requires, and the conformance to the standards
32
34
wherever possible.  When configuring Mutt for MIME, there are two extra
33
35
types of configuration files which Mutt uses.  One is the
34
 
<code class="literal">mime.types</code> file, which contains the mapping of file extensions to
35
 
IANA MIME types.  The other is the <code class="literal">mailcap</code> file, which specifies
36
 
the external commands to use for handling specific MIME types.
37
 
</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="using-mime"></a>1. Using MIME in Mutt</h2></div></div></div><p>
38
 
There are three areas/menus in Mutt which deal with MIME, they are the
39
 
pager (while viewing a message), the attachment menu and the compose
40
 
menu.
41
 
</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="mime-pager"></a>1.1. Viewing MIME Messages in the Pager</h3></div></div></div><p>
 
36
<code class="literal">mime.types</code> file, which contains the mapping of file
 
37
extensions to IANA MIME types.  The other is the
 
38
<code class="literal">mailcap</code> file, which specifies the external commands
 
39
to use for handling specific MIME types.
 
40
</p><div class="sect1" title="1. Using MIME in Mutt"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="using-mime"></a>1. Using MIME in Mutt</h2></div></div></div><div class="sect2" title="1.1. MIME Overview"><div class="titlepage"><div><div><h3 class="title"><a id="mime-overview"></a>1.1. MIME Overview</h3></div></div></div><p>
 
41
MIME is short for <span class="quote">“<span class="quote">Multipurpose Internet Mail Extension</span>”</span>
 
42
and describes mechanisms to internationalize and structure mail
 
43
messages. Before the introduction of MIME, messages had a single text
 
44
part and were limited to us-ascii header and content. With MIME,
 
45
messages can have attachments (and even attachments which itself have
 
46
attachments and thus form a tree structure), nearly arbitrary characters
 
47
can be used for sender names, recipients and subjects.
 
48
</p><p>
 
49
Besides the handling of non-ascii characters in message headers, to Mutt
 
50
the most important aspect of MIME are so-called MIME types. These are
 
51
constructed using a <span class="emphasis"><em>major</em></span> and
 
52
<span class="emphasis"><em>minor</em></span> type separated by a forward slash.  These
 
53
specify details about the content that follows. Based upon these, Mutt
 
54
decides how to handle this part. The most popular major type is
 
55
<span class="quote">“<span class="quote"><code class="literal">text</code></span>”</span> with minor types for plain text,
 
56
HTML and various other formats. Major types also exist for images,
 
57
audio, video and of course general application data (e.g. to separate
 
58
cryptographically signed data with a signature, send office documents,
 
59
and in general arbitrary binary data). There's also the
 
60
<code class="literal">multipart</code> major type which represents the root of a
 
61
subtree of MIME parts. A list of supported MIME types can be found in
 
62
<a class="xref" href="mimesupport.html#supported-mime-types" title="Table 5.1. Supported MIME types">Table 5.1, “Supported MIME types”</a>.
 
63
</p><p>
 
64
MIME also defines a set of encoding schemes for transporting MIME
 
65
content over the network: <code class="literal">7bit</code>,
 
66
<code class="literal">8bit</code>, <code class="literal">quoted-printable</code>,
 
67
<code class="literal">base64</code> and <code class="literal">binary</code>. There're some
 
68
rules when to choose what for encoding headers and/or body (if needed),
 
69
and Mutt will in general make a good choice.
 
70
</p><p>
 
71
Mutt does most of MIME encoding/decoding behind the scenes to form
 
72
messages conforming to MIME on the sending side. On reception, it can be
 
73
flexibly configured as to how what MIME structure is displayed (and if
 
74
it's displayed): these decisions are based on the content's MIME type.
 
75
There are three areas/menus in dealing with MIME: the pager (while
 
76
viewing a message), the attachment menu and the compose menu.
 
77
</p></div><div class="sect2" title="1.2. Viewing MIME Messages in the Pager"><div class="titlepage"><div><div><h3 class="title"><a id="mime-pager"></a>1.2. Viewing MIME Messages in the Pager</h3></div></div></div><p>
42
78
When you select a message from the index and view it in the pager, Mutt
43
 
decodes the message to a text representation.  Mutt internally supports
44
 
a number of MIME types, including <code class="literal">text/plain, text/enriched,
45
 
message/rfc822, and message/news</code>.  In addition, the export
46
 
controlled version of Mutt recognizes a variety of PGP MIME types,
47
 
including PGP/MIME and application/pgp.
 
79
decodes as much of a message as possible to a text representation.  Mutt
 
80
internally supports a number of MIME types, including the
 
81
<code class="literal">text</code> major type (with all minor types), the
 
82
<code class="literal">message/rfc822</code> (mail messages) type and some
 
83
<code class="literal">multipart</code> types. In addition, it recognizes a variety
 
84
of PGP MIME types, including PGP/MIME and
 
85
<code class="literal">application/pgp</code>.
48
86
</p><p>
49
87
Mutt will denote attachments with a couple lines describing them.
50
88
These lines are of the form:
52
90
[-- Attachment #1: Description --]
53
91
[-- Type: text/plain, Encoding: 7bit, Size: 10000 --]
54
92
</pre><p>
55
 
Where the <code class="literal">Description</code> is the description or filename given for the
56
 
attachment, and the <code class="literal">Encoding</code> is one of
57
 
<code class="literal">7bit/8bit/quoted-printable/base64/binary</code>.
 
93
Where the <span class="emphasis"><em>Description</em></span> is the description or
 
94
filename given for the attachment, and the <span class="emphasis"><em>Encoding</em></span>
 
95
is one of the already mentioned content encodings.
58
96
</p><p>
59
97
If Mutt cannot deal with a MIME type, it will display a message like:
60
98
</p><pre class="screen">
61
99
[-- image/gif is unsupported (use 'v' to view this part) --]
62
 
</pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="attach-menu"></a>1.2. The Attachment Menu</h3></div></div></div><p>
63
 
The default binding for <code class="literal">&lt;view-attachments&gt;</code> is “<span class="quote">v</span>”, which displays the
64
 
attachment menu for a message.  The attachment menu displays a list of
65
 
the attachments in a message.  From the attachment menu, you can save,
66
 
print, pipe, delete, and view attachments.  You can apply these
67
 
operations to a group of attachments at once, by tagging the attachments
68
 
and by using the <code class="literal">&lt;tag-prefix&gt;</code> operator.  You can also reply to the
69
 
current message from this menu, and only the current attachment (or the
70
 
attachments tagged) will be quoted in your reply.  You can view
71
 
attachments as text, or view them using the mailcap viewer definition.
72
 
</p><p>
73
 
Finally, you can apply the usual message-related functions (like
74
 
<a class="link" href="gettingstarted.html#resend-message"><code class="literal">&lt;resend-message&gt;</code></a>, and the
75
 
<code class="literal">&lt;reply&gt;</code> and <code class="literal">&lt;forward&gt;</code>
76
 
functions) to attachments of type <code class="literal">message/rfc822</code>.
77
 
</p><p>
78
 
See the help on the attachment menu for more information.
79
 
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="compose-menu"></a>1.3. The Compose Menu</h3></div></div></div><p>
 
100
</pre></div><div class="sect2" title="1.3. The Attachment Menu"><div class="titlepage"><div><div><h3 class="title"><a id="attach-menu"></a>1.3. The Attachment Menu</h3></div></div></div><p>
 
101
The default binding for <code class="literal">&lt;view-attachments&gt;</code> is
 
102
<span class="quote">“<span class="quote">v</span>”</span>, which displays the attachment menu for a message.  The
 
103
attachment menu displays a list of the attachments in a message.  From
 
104
the attachment menu, you can save, print, pipe, delete, and view
 
105
attachments.  You can apply these operations to a group of attachments
 
106
at once, by tagging the attachments and by using the
 
107
<code class="literal">&lt;tag-prefix&gt;</code> operator.  You can also reply to
 
108
the current message from this menu, and only the current attachment (or
 
109
the attachments tagged) will be quoted in your reply.  You can view
 
110
attachments as text, or view them using the mailcap viewer definition
 
111
(the mailcap mechanism is explained later in detail).
 
112
</p><p>
 
113
Finally, you can apply the usual message-related functions (like <a class="link" href="gettingstarted.html#resend-message"><code class="literal">&lt;resend-message&gt;</code></a>,
 
114
and the <code class="literal">&lt;reply&gt;</code> and
 
115
<code class="literal">&lt;forward&gt;</code> functions) to attachments of type
 
116
<code class="literal">message/rfc822</code>.
 
117
</p><p>
 
118
See table <a class="xref" href="reference.html#tab-attachment-bindings" title="Table 9.7. Default Attachment Menu Bindings">Table 9.7, “Default Attachment Menu Bindings”</a> for all available
 
119
functions.
 
120
</p></div><div class="sect2" title="1.4. The Compose Menu"><div class="titlepage"><div><div><h3 class="title"><a id="compose-menu"></a>1.4. The Compose Menu</h3></div></div></div><p>
80
121
The compose menu is the menu you see before you send a message.  It
81
 
allows you to edit the recipient list, the subject, and other aspects
82
 
of your message.  It also contains a list of the attachments of your
 
122
allows you to edit the recipient list, the subject, and other aspects of
 
123
your message.  It also contains a list of the attachments of your
83
124
message, including the main body.  From this menu, you can print, copy,
84
 
filter, pipe, edit, compose, review, and rename an attachment or a
85
 
list of tagged attachments.  You can also modifying the attachment
 
125
filter, pipe, edit, compose, review, and rename an attachment or a list
 
126
of tagged attachments.  You can also modifying the attachment
86
127
information, notably the type, encoding and description.
87
128
</p><p>
88
 
Attachments appear as follows:
 
129
Attachments appear as follows by default:
89
130
</p><pre class="screen">
90
131
- 1 [text/plain, 7bit, 1K]           /tmp/mutt-euler-8082-0 &lt;no description&gt;
91
132
  2 [applica/x-gunzip, base64, 422K] ~/src/mutt-0.85.tar.gz &lt;no description&gt;
92
133
</pre><p>
93
 
The '-' denotes that Mutt will delete the file after sending (or
94
 
postponing, or canceling) the message.  It can be toggled with the
95
 
<code class="literal">&lt;toggle-unlink&gt;</code> command (default: u).  The next field is the MIME
96
 
content-type, and can be changed with the <code class="literal">&lt;edit-type&gt;</code> command
97
 
(default: ^T).  The next field is the encoding for the attachment,
98
 
which allows a binary message to be encoded for transmission on 7bit
99
 
links.  It can be changed with the <code class="literal">&lt;edit-encoding&gt;</code> command
100
 
(default: ^E).  The next field is the size of the attachment,
101
 
rounded to kilobytes or megabytes.  The next field is the filename,
102
 
which can be changed with the <code class="literal">&lt;rename-file&gt;</code> command (default: R).
103
 
The final field is the description of the attachment, and can be
104
 
changed with the <code class="literal">&lt;edit-description&gt;</code> command (default: d).
105
 
</p></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mime-types"></a>2. MIME Type Configuration with <code class="literal">mime.types</code></h2></div></div></div><p>
 
134
The <span class="quote">“<span class="quote">-</span>”</span> denotes that Mutt will delete the file after
 
135
sending (or postponing, or canceling) the message.  It can be toggled
 
136
with the <code class="literal">&lt;toggle-unlink&gt;</code> command (default: u).
 
137
The next field is the MIME content-type, and can be changed with the
 
138
<code class="literal">&lt;edit-type&gt;</code> command (default: ^T).  The next
 
139
field is the encoding for the attachment, which allows a binary message
 
140
to be encoded for transmission on 7bit links.  It can be changed with
 
141
the <code class="literal">&lt;edit-encoding&gt;</code> command (default: ^E).  The
 
142
next field is the size of the attachment, rounded to kilobytes or
 
143
megabytes.  The next field is the filename, which can be changed with
 
144
the <code class="literal">&lt;rename-file&gt;</code> command (default: R).  The
 
145
final field is the description of the attachment, and can be changed
 
146
with the <code class="literal">&lt;edit-description&gt;</code> command (default:
 
147
d). See <a class="link" href="reference.html#attach-format" title="3.13. attach_format">$attach_format</a> for a full
 
148
list of available expandos to format this display to your needs.
 
149
</p></div></div><div class="sect1" title="2. MIME Type Configuration with mime.types"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mime-types"></a>2. MIME Type Configuration with <code class="literal">mime.types</code></h2></div></div></div><p>
 
150
To get most out of MIME, it's important that a MIME part's content type
 
151
matches the content as closely as possible so that the recipient's
 
152
client can automatically select the right viewer for the
 
153
content. However, there's no reliable for Mutt to know how to detect
 
154
every possible file type. Instead, it uses a simple plain text mapping
 
155
file that specifies what file extension corresponds to what MIME
 
156
type. This file is called <code class="literal">mime.types</code>.
 
157
</p><p>
106
158
When you add an attachment to your mail message, Mutt searches your
107
 
personal <code class="literal">mime.types</code> file at <code class="literal">${HOME}/.mime.types</code>, and then
108
 
the system <code class="literal">mime.types</code> file at <code class="literal">/usr/local/share/mutt/mime.types</code> or
 
159
personal <code class="literal">mime.types</code> file at
 
160
<code class="literal">$HOME/.mime.types</code>, and then the system
 
161
<code class="literal">mime.types</code> file at
 
162
<code class="literal">/usr/local/share/mutt/mime.types</code> or
109
163
<code class="literal">/etc/mime.types</code>
110
164
</p><p>
111
 
The <code class="literal">mime.types</code> file consist of lines containing a MIME type and a space
112
 
separated list of extensions.  For example:
113
 
</p><pre class="screen">
 
165
Each line starts with the full MIME type, followed by a space and
 
166
space-separated list of file extensions. For example you could use:
 
167
</p><div class="example"><a id="ex-mime-types"></a><p class="title"><b>Example 5.1. <code class="literal">mime.types</code></b></p><div class="example-contents"><pre class="screen">
114
168
application/postscript          ps eps
115
169
application/pgp                 pgp
116
170
audio/x-aiff                    aif aifc aiff
117
 
</pre><p>
118
 
A sample <code class="literal">mime.types</code> file comes with the Mutt distribution, and
119
 
should contain most of the MIME types you are likely to use.
 
171
</pre></div></div><br class="example-break" /><p>
 
172
A sample <code class="literal">mime.types</code> file comes with the Mutt
 
173
distribution, and should contain most of the MIME types you are likely
 
174
to use.
120
175
</p><p>
121
 
If Mutt can not determine the mime type by the extension of the file you
 
176
If Mutt can not determine the MIME type by the extension of the file you
122
177
attach, it will look at the file.  If the file is free of binary
123
178
information, Mutt will assume that the file is plain text, and mark it
124
 
as <code class="literal">text/plain</code>.  If the file contains binary information, then Mutt will
125
 
mark it as <code class="literal">application/octet-stream</code>.  You can change the MIME
126
 
type that Mutt assigns to an attachment by using the <code class="literal">&lt;edit-type&gt;</code>
127
 
command from the compose menu (default: ^T). The MIME type is actually a
128
 
major mime type followed by the sub-type, separated by a '/'. 6 major
129
 
types: application, text, image, video, audio, and model have been approved
130
 
after various internet discussions. Mutt recognizes all of these if the
131
 
appropriate entry is found in the <code class="literal">mime.types</code> file. It also recognizes other
132
 
major mime types, such as the chemical type that is widely used in the
133
 
molecular modeling community to pass molecular data in various forms to
134
 
various molecular viewers. Non-recognized mime types should only be used
135
 
if the recipient of the message is likely to be expecting such attachments.
136
 
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailcap"></a>3. MIME Viewer Configuration with Mailcap</h2></div></div></div><p>
 
179
as <code class="literal">text/plain</code>.  If the file contains binary
 
180
information, then Mutt will mark it as
 
181
<code class="literal">application/octet-stream</code>.  You can change the MIME
 
182
type that Mutt assigns to an attachment by using the
 
183
<code class="literal">&lt;edit-type&gt;</code> command from the compose menu
 
184
(default: ^T), see <a class="xref" href="mimesupport.html#supported-mime-types" title="Table 5.1. Supported MIME types">Table 5.1, “Supported MIME types”</a> for supported
 
185
major types. Mutt recognizes all of these if the appropriate entry is
 
186
found in the <code class="literal">mime.types</code> file. Non-recognized mime
 
187
types should only be used if the recipient of the message is likely to
 
188
be expecting such attachments.
 
189
</p><div class="table"><a id="supported-mime-types"></a><p class="title"><b>Table 5.1. Supported MIME types</b></p><div class="table-contents"><table summary="Supported MIME types" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>MIME major type</th><th>Standard</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">application</code></td><td>yes</td><td>General application data</td></tr><tr><td><code class="literal">audio</code></td><td>yes</td><td>Audio data</td></tr><tr><td><code class="literal">image</code></td><td>yes</td><td>Image data</td></tr><tr><td><code class="literal">message</code></td><td>yes</td><td>Mail messages, message status information</td></tr><tr><td><code class="literal">model</code></td><td>yes</td><td>VRML and other modeling data</td></tr><tr><td><code class="literal">multipart</code></td><td>yes</td><td>Container for other MIME parts</td></tr><tr><td><code class="literal">text</code></td><td>yes</td><td>Text data</td></tr><tr><td><code class="literal">video</code></td><td>yes</td><td>Video data</td></tr><tr><td><code class="literal">chemical</code></td><td>no</td><td>Mostly molecular data</td></tr></tbody></table></div></div><br class="table-break" /><p>
 
190
MIME types are not arbitrary, they need to be assigned by <a class="ulink" href="http://www.iana.org/assignments/media-types/" target="_top">IANA</a>.
 
191
</p></div><div class="sect1" title="3. MIME Viewer Configuration with Mailcap"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailcap"></a>3. MIME Viewer Configuration with Mailcap</h2></div></div></div><p>
137
192
Mutt supports RFC 1524 MIME Configuration, in particular the Unix
138
193
specific format specified in Appendix A of RFC 1524.  This file format
139
 
is commonly referred to as the mailcap format.  Many MIME compliant
140
 
programs utilize the mailcap format, allowing you to specify handling
141
 
for all MIME types in one place for all programs.  Programs known to
142
 
use this format include Firefox, lynx and metamail.
 
194
is commonly referred to as the <span class="quote">“<span class="quote">mailcap</span>”</span> format.  Many MIME
 
195
compliant programs utilize the mailcap format, allowing you to specify
 
196
handling for all MIME types in one place for all programs.  Programs
 
197
known to use this format include Firefox, lynx and metamail.
143
198
</p><p>
144
 
In order to handle various MIME types that Mutt can not handle
145
 
internally, Mutt parses a series of external configuration files to
146
 
find an external handler. The default search string for these files
147
 
is a colon delimited list containing the following files:
148
 
</p><div class="orderedlist"><ol type="1"><li><p><code class="literal">$HOME/.mailcap</code></p></li><li><p><code class="literal">$PKGDATADIR/mailcap</code></p></li><li><p><code class="literal">$SYSCONFDIR/mailcap</code></p></li><li><p><code class="literal">/etc/mailcap</code></p></li><li><p><code class="literal">/usr/etc/mailcap</code></p></li><li><p><code class="literal">/usr/local/etc/mailcap</code></p></li></ol></div><p>
 
199
In order to handle various MIME types that Mutt doesn't have built-in
 
200
support for, it parses a series of external configuration files to find
 
201
an external handler. The default search string for these files is a
 
202
colon delimited list containing the following files:
 
203
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p><code class="literal">$HOME/.mailcap</code></p></li><li class="listitem"><p><code class="literal">$PKGDATADIR/mailcap</code></p></li><li class="listitem"><p><code class="literal">$SYSCONFDIR/mailcap</code></p></li><li class="listitem"><p><code class="literal">/etc/mailcap</code></p></li><li class="listitem"><p><code class="literal">/usr/etc/mailcap</code></p></li><li class="listitem"><p><code class="literal">/usr/local/etc/mailcap</code></p></li></ol></div><p>
149
204
where <code class="literal">$HOME</code> is your home directory. The
150
 
<code class="literal">$PKGDATADIR</code> and the
151
 
<code class="literal">$SYSCONFDIR</code> directories depend on where Mutt
152
 
is installed: the former is the default for shared data, the
153
 
latter for system configuration files.
 
205
<code class="literal">$PKGDATADIR</code> and the <code class="literal">$SYSCONFDIR</code>
 
206
directories depend on where Mutt is installed: the former is the default
 
207
for shared data, the latter for system configuration files.
154
208
</p><p>
155
209
The default search path can be obtained by running the following
156
210
command:
158
212
mutt -nF /dev/null -Q mailcap_path
159
213
</pre><p>
160
214
In particular, the metamail distribution will install a mailcap file,
161
 
usually as <code class="literal">/usr/local/etc/mailcap</code>, which contains some baseline
162
 
entries.
163
 
</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="mailcap-basics"></a>3.1. The Basics of the Mailcap File</h3></div></div></div><p>
 
215
usually as <code class="literal">/usr/local/etc/mailcap</code>, which contains
 
216
some baseline entries.
 
217
</p><div class="sect2" title="3.1. The Basics of the Mailcap File"><div class="titlepage"><div><div><h3 class="title"><a id="mailcap-basics"></a>3.1. The Basics of the Mailcap File</h3></div></div></div><p>
164
218
A mailcap file consists of a series of lines which are comments, blank,
165
219
or definitions.
166
220
</p><p>
170
224
</p><p>
171
225
A definition line consists of a content type, a view command, and any
172
226
number of optional fields.  Each field of a definition line is divided
173
 
by a semicolon ';' character.
 
227
by a semicolon <span class="quote">“<span class="quote">;</span>”</span> character.
174
228
</p><p>
175
 
The content type is specified in the MIME standard type/subtype method.
176
 
For example,
177
 
<code class="literal">text/plain, text/html, image/gif, </code>
178
 
etc.  In addition, the mailcap format includes two formats for
179
 
wildcards, one using the special '*' subtype, the other is the implicit
180
 
wild, where you only include the major type.  For example, <code class="literal">image/*</code>, or
181
 
<code class="literal">video,</code> will match all image types and video types,
 
229
The content type is specified in the MIME standard
 
230
<span class="quote">“<span class="quote">type/subtype</span>”</span> notation.  For example,
 
231
<code class="literal">text/plain</code>, <code class="literal">text/html</code>,
 
232
<code class="literal">image/gif</code>, etc.  In addition, the mailcap format
 
233
includes two formats for wildcards, one using the special
 
234
<span class="quote">“<span class="quote">*</span>”</span> subtype, the other is the implicit wild, where you only
 
235
include the major type.  For example, <code class="literal">image/*</code>, or
 
236
<code class="literal">video</code> will match all image types and video types,
182
237
respectively.
183
238
</p><p>
184
239
The view command is a Unix command for viewing the type specified. There
185
240
are two different types of commands supported. The default is to send
186
241
the body of the MIME message to the command on stdin. You can change
187
 
this behavior by using %s as a parameter to your view command.
188
 
This will cause Mutt to save the body of the MIME message to a temporary
189
 
file, and then call the view command with the %s replaced by
190
 
the name of the temporary file. In both cases, Mutt will turn over the
191
 
terminal to the view program until the program quits, at which time Mutt
192
 
will remove the temporary file if it exists.
 
242
this behavior by using <code class="literal">%s</code> as a parameter to your view
 
243
command.  This will cause Mutt to save the body of the MIME message to a
 
244
temporary file, and then call the view command with the
 
245
<code class="literal">%s</code> replaced by the name of the temporary file. In
 
246
both cases, Mutt will turn over the terminal to the view program until
 
247
the program quits, at which time Mutt will remove the temporary file if
 
248
it exists. This means that mailcap does <span class="emphasis"><em>not</em></span> work
 
249
out of the box with programs which detach themselves from the terminal
 
250
right after starting, like <code class="literal">open</code> on Mac OS X. In order
 
251
to nevertheless use these programs with mailcap, you probably need
 
252
custom shell scripts.
193
253
</p><p>
194
 
So, in the simplest form, you can send a text/plain message to the
195
 
external pager more on stdin:
 
254
So, in the simplest form, you can send a <code class="literal">text/plain</code>
 
255
message to the external pager more on standard input:
196
256
</p><pre class="screen">
197
257
text/plain; more
198
258
</pre><p>
200
260
</p><pre class="screen">
201
261
text/plain; more %s
202
262
</pre><p>
203
 
Perhaps you would like to use lynx to interactively view a text/html
204
 
message:
 
263
Perhaps you would like to use lynx to interactively view a
 
264
<code class="literal">text/html</code> message:
205
265
</p><pre class="screen">
206
266
text/html; lynx %s
207
267
</pre><p>
208
 
In this case, lynx does not support viewing a file from stdin, so you
209
 
must use the %s syntax.
210
 
</p><div class="note"><h3 class="title">Note</h3><p>
211
 
<span class="emphasis"><em>Some older versions of lynx contain a bug where they
212
 
will check the mailcap file for a viewer for text/html.  They will find
213
 
the line which calls lynx, and run it.  This causes lynx to continuously
214
 
spawn itself to view the object.</em></span>
 
268
In this case, lynx does not support viewing a file from standard input,
 
269
so you must use the <code class="literal">%s</code> syntax.
 
270
</p><div class="note" title="Note"><h3 class="title">Note</h3><p>
 
271
<span class="emphasis"><em>Some older versions of lynx contain a bug where they will
 
272
check the mailcap file for a viewer for <code class="literal">text/html</code>.
 
273
They will find the line which calls lynx, and run it.  This causes lynx
 
274
to continuously spawn itself to view the object.</em></span>
215
275
</p></div><p>
216
276
On the other hand, maybe you don't want to use lynx interactively, you
217
 
just want to have it convert the text/html to text/plain, then you can
218
 
use:
 
277
just want to have it convert the <code class="literal">text/html</code> to
 
278
<code class="literal">text/plain</code>, then you can use:
219
279
</p><pre class="screen">
220
280
text/html; lynx -dump %s | more
221
281
</pre><p>
222
 
Perhaps you wish to use lynx to view text/html files, and a pager on
223
 
all other text formats, then you would use the following:
 
282
Perhaps you wish to use lynx to view <code class="literal">text/html</code> files,
 
283
and a pager on all other text formats, then you would use the following:
224
284
</p><pre class="screen">
225
285
text/html; lynx %s
226
286
text/*; more
227
 
</pre><p>
228
 
This is the simplest form of a mailcap file.
229
 
</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="secure-mailcap"></a>3.2. Secure Use of Mailcap</h3></div></div></div><p>
 
287
</pre></div><div class="sect2" title="3.2. Secure Use of Mailcap"><div class="titlepage"><div><div><h3 class="title"><a id="secure-mailcap"></a>3.2. Secure Use of Mailcap</h3></div></div></div><p>
230
288
The interpretation of shell meta-characters embedded in MIME parameters
231
 
can lead to security problems in general.  Mutt tries to quote parameters
232
 
in expansion of %s syntaxes properly, and avoids risky characters by
233
 
substituting them, see the <a class="link" href="reference.html#mailcap-sanitize" title="3.120. mailcap_sanitize">$mailcap_sanitize</a> variable.
 
289
can lead to security problems in general.  Mutt tries to quote
 
290
parameters in expansion of <code class="literal">%s</code> syntaxes properly, and
 
291
avoids risky characters by substituting them, see the <a class="link" href="reference.html#mailcap-sanitize" title="3.121. mailcap_sanitize">$mailcap_sanitize</a> variable.
234
292
</p><p>
235
293
Although Mutt's procedures to invoke programs with mailcap seem to be
236
 
safe, there are other applications parsing mailcap, maybe taking less care
237
 
of it.  Therefore you should pay attention to the following rules:
 
294
safe, there are other applications parsing mailcap, maybe taking less
 
295
care of it.  Therefore you should pay attention to the following rules:
238
296
</p><p>
239
 
<span class="emphasis"><em>Keep the %-expandos away from shell quoting.</em></span>
240
 
Don't quote them with single or double quotes.  Mutt does this for
241
 
you, the right way, as should any other program which interprets
242
 
mailcap.  Don't put them into backtick expansions.  Be highly careful
243
 
with eval statements, and avoid them if possible at all.  Trying to fix
244
 
broken behavior with quotes introduces new leaks - there is no
 
297
<span class="emphasis"><em>Keep the %-expandos away from shell quoting.</em></span> Don't
 
298
quote them with single or double quotes.  Mutt does this for you, the
 
299
right way, as should any other program which interprets mailcap.  Don't
 
300
put them into backtick expansions.  Be highly careful with evil
 
301
statements, and avoid them if possible at all.  Trying to fix broken
 
302
behavior with quotes introduces new leaks — there is no
245
303
alternative to correct quoting in the first place.
246
304
</p><p>
247
305
If you have to use the %-expandos' values in context where you need
248
 
quoting or backtick expansions, put that value into a shell variable
249
 
and reference the shell variable where necessary, as in the following
250
 
example (using <code class="literal">$charset</code> inside the backtick expansion is safe,
251
 
since it is not itself subject to any further expansion):
 
306
quoting or backtick expansions, put that value into a shell variable and
 
307
reference the shell variable where necessary, as in the following
 
308
example (using <code class="literal">$charset</code> inside the backtick expansion
 
309
is safe, since it is not itself subject to any further expansion):
252
310
</p><pre class="screen">
253
311
text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \
254
312
        &amp;&amp; test "`echo $charset | tr '[A-Z]' '[a-z]'`" != iso-8859-1
255
 
</pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="advanced-mailcap"></a>3.3. Advanced Mailcap Usage</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="optional-mailcap-fields"></a>3.3.1. Optional Fields</h4></div></div></div><p>
 
313
</pre></div><div class="sect2" title="3.3. Advanced Mailcap Usage"><div class="titlepage"><div><div><h3 class="title"><a id="advanced-mailcap"></a>3.3. Advanced Mailcap Usage</h3></div></div></div><div class="sect3" title="3.3.1. Optional Fields"><div class="titlepage"><div><div><h4 class="title"><a id="optional-mailcap-fields"></a>3.3.1. Optional Fields</h4></div></div></div><p>
256
314
In addition to the required content-type and view command fields, you
257
 
can add semi-colon ';' separated fields to set flags and other options.
258
 
Mutt recognizes the following optional fields:
 
315
can add semi-colon <span class="quote">“<span class="quote">;</span>”</span> separated fields to set flags and
 
316
other options.  Mutt recognizes the following optional fields:
259
317
</p><div class="variablelist"><dl><dt><span class="term">copiousoutput</span></dt><dd><p>
260
318
This flag tells Mutt that the command passes possibly large amounts of
261
 
text on stdout.  This causes Mutt to invoke a pager (either the internal
262
 
pager or the external pager defined by the pager variable) on the output
263
 
of the view command.  Without this flag, Mutt assumes that the command
264
 
is interactive.  One could use this to replace the pipe to <code class="literal">more</code>
265
 
in the <code class="literal">lynx -dump</code> example in the Basic section:
 
319
text on standard output.  This causes Mutt to invoke a pager (either
 
320
the internal pager or the external pager defined by the pager variable)
 
321
on the output of the view command.  Without this flag, Mutt assumes that
 
322
the command is interactive.  One could use this to replace the pipe to
 
323
<code class="literal">more</code> in the <code class="literal">lynx -dump</code> example in
 
324
the Basic section:
266
325
</p><pre class="screen">
267
326
text/html; lynx -dump %s ; copiousoutput
268
327
</pre><p>
269
 
This will cause lynx to format the text/html output as text/plain
270
 
and Mutt will use your standard pager to display the results.
 
328
This will cause lynx to format the <code class="literal">text/html</code> output
 
329
as <code class="literal">text/plain</code> and Mutt will use your standard pager
 
330
to display the results.
 
331
</p><p>
 
332
Note that when using the built-in pager, <span class="emphasis"><em>only</em></span>
 
333
entries with this flag will be considered a handler for a MIME type
 
334
— all other entries will be ignored.
271
335
</p></dd><dt><span class="term">needsterminal</span></dt><dd><p>
272
 
Mutt uses this flag when viewing attachments with <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, in order to decide whether it should honor the setting
273
 
of the <a class="link" href="reference.html#wait-key" title="3.304. wait_key">$wait_key</a> variable or
274
 
not.  When an attachment is viewed using an interactive program, and the
275
 
corresponding mailcap entry has a <span class="emphasis"><em>needsterminal</em></span> flag, Mutt will use
276
 
<a class="link" href="reference.html#wait-key" title="3.304. wait_key">$wait_key</a> and the exit status
277
 
of the program to decide if it will ask you to press a key after the
278
 
external program has exited.  In all other situations it will not prompt
279
 
you for a key.
 
336
Mutt uses this flag when viewing attachments with <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, in order to
 
337
decide whether it should honor the setting of the <a class="link" href="reference.html#wait-key" title="3.305. wait_key">$wait_key</a> variable or not.  When an attachment
 
338
is viewed using an interactive program, and the corresponding mailcap
 
339
entry has a <span class="emphasis"><em>needsterminal</em></span> flag, Mutt will use <a class="link" href="reference.html#wait-key" title="3.305. wait_key">$wait_key</a> and the exit status of the program
 
340
to decide if it will ask you to press a key after the external program
 
341
has exited.  In all other situations it will not prompt you for a key.
280
342
</p></dd><dt><span class="term">compose=&lt;command&gt;</span></dt><dd><p>
281
343
This flag specifies the command to use to create a new attachment of a
282
344
specific MIME type.  Mutt supports this from the compose menu.
285
347
specific MIME type.  This command differs from the compose command in
286
348
that Mutt will expect standard MIME headers on the data.  This can be
287
349
used to specify parameters, filename, description, etc. for a new
288
 
attachment.   Mutt supports this from the compose menu.
 
350
attachment.  Mutt supports this from the compose menu.
289
351
</p></dd><dt><span class="term">print=&lt;command&gt;</span></dt><dd><p>
290
352
This flag specifies the command to use to print a specific MIME type.
291
353
Mutt supports this from the attachment and compose menus.
292
354
</p></dd><dt><span class="term">edit=&lt;command&gt;</span></dt><dd><p>
293
355
This flag specifies the command to use to edit a specific MIME type.
294
356
Mutt supports this from the compose menu, and also uses it to compose
295
 
new attachments.  Mutt will default to the defined editor for text
296
 
attachments.
 
357
new attachments.  Mutt will default to the defined <a class="link" href="reference.html#editor" title="3.58. editor">$editor</a> for text attachments.
297
358
</p></dd><dt><span class="term">nametemplate=&lt;template&gt;</span></dt><dd><p>
298
 
This field specifies the format for the file denoted by %s in the
299
 
command fields.  Certain programs will require a certain file extension,
300
 
for instance, to correctly view a file.  For instance, lynx will only
301
 
interpret a file as <code class="literal">text/html</code> if the file ends in <code class="literal">.html</code>.
302
 
So, you would specify lynx as a <code class="literal">text/html</code> viewer with a line in
303
 
the mailcap file like:
 
359
This field specifies the format for the file denoted by
 
360
<code class="literal">%s</code> in the command fields.  Certain programs will
 
361
require a certain file extension, for instance, to correctly view a
 
362
file.  For instance, lynx will only interpret a file as
 
363
<code class="literal">text/html</code> if the file ends in
 
364
<code class="literal">.html</code>.  So, you would specify lynx as a
 
365
<code class="literal">text/html</code> viewer with a line in the mailcap file
 
366
like:
304
367
</p><pre class="screen">
305
368
text/html; lynx %s; nametemplate=%s.html
306
369
</pre></dd><dt><span class="term">test=&lt;command&gt;</span></dt><dd><p>
307
 
This field specifies a command to run to test whether this mailcap
308
 
entry should be used.  The command is defined with the command expansion
309
 
rules defined in the next section.  If the command returns 0, then the
310
 
test passed, and Mutt uses this entry.  If the command returns non-zero,
311
 
then the test failed, and Mutt continues searching for the right entry.
312
 
Note that the content-type must match before Mutt performs the test.
313
 
For example:
 
370
This field specifies a command to run to test whether this mailcap entry
 
371
should be used.  The command is defined with the command expansion rules
 
372
defined in the next section.  If the command returns 0, then the test
 
373
passed, and Mutt uses this entry.  If the command returns non-zero, then
 
374
the test failed, and Mutt continues searching for the right entry.  Note
 
375
that the content-type must match before Mutt performs the test.  For
 
376
example:
314
377
</p><pre class="screen">
315
378
text/html; firefox -remote 'openURL(%s)' ; test=RunningX
316
379
text/html; lynx %s
317
380
</pre><p>
318
 
In this example, Mutt will run the program RunningX which will return 0
319
 
if the X Window manager is running, and non-zero if it isn't.  If
320
 
RunningX returns 0, then Mutt will call firefox to display the
321
 
<code class="literal">text/html</code> object.  If RunningX doesn't return 0, then Mutt will go on
322
 
to the next entry and use lynx to display the <code class="literal">text/html</code> object.
323
 
</p></dd></dl></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="mailcap-search-order"></a>3.3.2. Search Order</h4></div></div></div><p>
 
381
In this example, Mutt will run the program <code class="literal">RunningX</code>
 
382
which will return 0 if the X Window manager is running, and non-zero if
 
383
it isn't.  If <code class="literal">RunningX</code> returns 0, then Mutt will run
 
384
firefox to display the <code class="literal">text/html</code> object.  If RunningX
 
385
doesn't return 0, then Mutt will go on to the next entry and use lynx to
 
386
display the <code class="literal">text/html</code> object.
 
387
</p></dd></dl></div></div><div class="sect3" title="3.3.2. Search Order"><div class="titlepage"><div><div><h4 class="title"><a id="mailcap-search-order"></a>3.3.2. Search Order</h4></div></div></div><p>
324
388
When searching for an entry in the mailcap file, Mutt will search for
325
389
the most useful entry for its purpose.  For instance, if you are
326
 
attempting to print an <code class="literal">image/gif</code>, and you have the following
327
 
entries in your mailcap file, Mutt will search for an entry with the
328
 
print command:
 
390
attempting to print an <code class="literal">image/gif</code>, and you have the
 
391
following entries in your mailcap file, Mutt will search for an entry
 
392
with the print command:
329
393
</p><pre class="screen">
330
394
image/*;        xv %s
331
395
image/gif;      ; print= anytopnm %s | pnmtops | lpr; \
332
396
                nametemplate=%s.gif
333
397
</pre><p>
334
 
Mutt will skip the <code class="literal">image/*</code> entry and use the <code class="literal">image/gif</code>
335
 
entry with the print command.
 
398
Mutt will skip the <code class="literal">image/*</code> entry and use the
 
399
<code class="literal">image/gif</code> entry with the print command.
336
400
</p><p>
337
 
In addition, you can use this with <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>
338
 
to denote two commands for viewing an attachment, one to be viewed
339
 
automatically, the other to be viewed interactively from the attachment
340
 
menu.  In addition, you can then use the test feature to determine which
341
 
viewer to use interactively depending on your environment.
 
401
In addition, you can use this with <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a> to denote two
 
402
commands for viewing an attachment, one to be viewed automatically, the
 
403
other to be viewed interactively from the attachment menu using the
 
404
<code class="literal">&lt;view-mailcap&gt;</code> function (bound to
 
405
<span class="quote">“<span class="quote">m</span>”</span> by default). In addition, you can then use the test
 
406
feature to determine which viewer to use interactively depending on your
 
407
environment.
342
408
</p><pre class="screen">
343
409
text/html;      firefox -remote 'openURL(%s)' ; test=RunningX
344
410
text/html;      lynx %s; nametemplate=%s.html
345
411
text/html;      lynx -dump %s; nametemplate=%s.html; copiousoutput
346
412
</pre><p>
347
 
For <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, Mutt will choose the third
348
 
entry because of the copiousoutput tag.  For interactive viewing, Mutt
349
 
will run the program RunningX to determine if it should use the first
350
 
entry.  If the program returns non-zero, Mutt will use the second entry
351
 
for interactive viewing.
352
 
</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="mailcap-command-expansion"></a>3.3.3. Command Expansion</h4></div></div></div><p>
 
413
For <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, Mutt
 
414
will choose the third entry because of the
 
415
<code class="literal">copiousoutput</code> tag.  For interactive viewing, Mutt
 
416
will run the program <code class="literal">RunningX</code> to determine if it
 
417
should use the first entry.  If the program returns non-zero, Mutt will
 
418
use the second entry for interactive viewing. The last entry is for
 
419
inline display in the pager and the
 
420
<code class="literal">&lt;view-attach&gt;</code> function in the attachment menu.
 
421
</p><p>
 
422
Entries with the <code class="literal">copiousoutput</code> tag should always be
 
423
specified as the last one per type. For non-interactive use, the last
 
424
entry will then actually be the first matching one with the tag set.
 
425
For non-interactive use, only <code class="literal">copiousoutput</code>-tagged
 
426
entries are considered. For interactive use, Mutt ignores this tag and
 
427
treats all entries equally. Therefore, if not specified last, all
 
428
following entries without this tag would never be considered for
 
429
<code class="literal">&lt;view-attach&gt;</code> because the
 
430
<code class="literal">copiousoutput</code> before them matched already.
 
431
</p></div><div class="sect3" title="3.3.3. Command Expansion"><div class="titlepage"><div><div><h4 class="title"><a id="mailcap-command-expansion"></a>3.3.3. Command Expansion</h4></div></div></div><p>
353
432
The various commands defined in the mailcap files are passed to the
354
 
<code class="literal">/bin/sh</code> shell using the <code class="literal">system(3)</code> function.  Before the
355
 
command is passed to <code class="literal">/bin/sh -c</code>, it is parsed to expand
356
 
various special parameters with information from Mutt.  The keywords
357
 
Mutt expands are:
 
433
<code class="literal">/bin/sh</code> shell using the <code class="literal">system(3)</code>
 
434
function.  Before the command is passed to <code class="literal">/bin/sh
 
435
-c</code>, it is parsed to expand various special parameters with
 
436
information from Mutt.  The keywords Mutt expands are:
358
437
</p><div class="variablelist"><dl><dt><span class="term">%s</span></dt><dd><p>
359
 
As seen in the basic mailcap section, this variable is expanded
360
 
to a filename specified by the calling program.  This file contains
361
 
the body of the message to view/print/edit or where the composing
362
 
program should place the results of composition.  In addition, the
363
 
use of this keyword causes Mutt to not pass the body of the message
364
 
to the view/print/edit program on stdin.
 
438
As seen in the basic mailcap section, this variable is expanded to a
 
439
filename specified by the calling program.  This file contains the body
 
440
of the message to view/print/edit or where the composing program should
 
441
place the results of composition.  In addition, the use of this keyword
 
442
causes Mutt to not pass the body of the message to the view/print/edit
 
443
program on stdin.
365
444
</p></dd><dt><span class="term">%t</span></dt><dd><p>
366
 
Mutt will expand %t to the text representation of the content
367
 
type of the message in the same form as the first parameter of the
368
 
mailcap definition line, ie <code class="literal">text/html</code> or
 
445
Mutt will expand <code class="literal">%t</code> to the text representation of the
 
446
content type of the message in the same form as the first parameter of
 
447
the mailcap definition line, i.e. <code class="literal">text/html</code> or
369
448
<code class="literal">image/gif</code>.
370
449
</p></dd><dt><span class="term">%{&lt;parameter&gt;}</span></dt><dd><p>
371
 
Mutt will expand this to the value of the specified parameter
372
 
from the Content-Type: line of the mail message.  For instance, if
373
 
Your mail message contains:
 
450
Mutt will expand this to the value of the specified parameter from the
 
451
Content-Type: line of the mail message.  For instance, if your mail
 
452
message contains:
374
453
</p><pre class="screen">
375
454
Content-Type: text/plain; charset=iso-8859-1
376
455
</pre><p>
377
 
then Mutt will expand %{charset} to iso-8859-1.  The default metamail
378
 
mailcap file uses this feature to test the charset to spawn an xterm
379
 
using the right charset to view the message.
 
456
then Mutt will expand <code class="literal">%{charset}</code> to
 
457
<span class="quote">“<span class="quote">iso-8859-1</span>”</span>.  The default metamail mailcap file uses this
 
458
feature to test the charset to spawn an xterm using the right charset to
 
459
view the message.
380
460
</p></dd><dt><span class="term">\%</span></dt><dd><p>
381
 
This will be replaced by a %
 
461
This will be replaced by a literal <code class="literal">%</code>.
382
462
</p></dd></dl></div><p>
383
 
Mutt does not currently support the %F and %n keywords
384
 
specified in RFC 1524.  The main purpose of these parameters is for
385
 
multipart messages, which is handled internally by Mutt.
386
 
</p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="mailcap-example"></a>3.4. Example Mailcap Files</h3></div></div></div><p>
 
463
Mutt does not currently support the <code class="literal">%F</code> and
 
464
<code class="literal">%n</code> keywords specified in RFC 1524.  The main purpose
 
465
of these parameters is for multipart messages, which is handled
 
466
internally by Mutt.
 
467
</p></div></div><div class="sect2" title="3.4. Example Mailcap Files"><div class="titlepage"><div><div><h3 class="title"><a id="mailcap-example"></a>3.4. Example Mailcap Files</h3></div></div></div><p>
387
468
This mailcap file is fairly simple and standard:
388
469
</p><pre class="screen">
389
 
# I'm always running X :)
 
470
<span class="comment"># I'm always running X :)</span>
390
471
video/*;        xanim %s &gt; /dev/null
391
472
image/*;        xv %s &gt; /dev/null
392
473
 
393
 
# I'm always running firefox (if my computer had more memory, maybe)
 
474
<span class="comment"># I'm always running firefox (if my computer had more memory, maybe)</span>
394
475
text/html;      firefox -remote 'openURL(%s)'
395
476
</pre><p>
396
477
This mailcap file shows quite a number of examples:
397
478
</p><pre class="screen">
398
 
# Use xanim to view all videos   Xanim produces a header on startup,
399
 
# send that to /dev/null so I don't see it
 
479
<span class="comment"># Use xanim to view all videos   Xanim produces a header on startup,
 
480
# send that to /dev/null so I don't see it</span>
400
481
video/*;        xanim %s &gt; /dev/null
401
482
 
402
 
# Send html to a running firefox by remote
 
483
<span class="comment"># Send html to a running firefox by remote</span>
403
484
text/html;      firefox -remote 'openURL(%s)'; test=RunningFirefox
404
485
 
405
 
# If I'm not running firefox but I am running X, start firefox on the
406
 
# object
 
486
<span class="comment"># If I'm not running firefox but I am running X, start firefox on the
 
487
# object</span>
407
488
text/html;      firefox %s; test=RunningX
408
489
 
409
 
# Else use lynx to view it as text
 
490
<span class="comment"># Else use lynx to view it as text</span>
410
491
text/html;      lynx %s
411
492
 
412
 
# This version would convert the text/html to text/plain
 
493
<span class="comment"># This version would convert the text/html to text/plain</span>
413
494
text/html;      lynx -dump %s; copiousoutput
414
495
 
415
 
# I use enscript to print text in two columns to a page
 
496
<span class="comment"># I use enscript to print text in two columns to a page</span>
416
497
text/*;         more %s; print=enscript -2Gr %s
417
498
 
418
 
# Firefox adds a flag to tell itself to view jpegs internally
 
499
<span class="comment"># Firefox adds a flag to tell itself to view jpegs internally</span>
419
500
image/jpeg;xv %s; x-mozilla-flags=internal
420
501
 
421
 
# Use xv to view images if I'm running X
422
 
# In addition, this uses the \ to extend the line and set my editor
423
 
# for images
 
502
<span class="comment"># Use xv to view images if I'm running X</span>
 
503
<span class="comment"># In addition, this uses the \ to extend the line and set my editor</span>
 
504
<span class="comment"># for images</span>
424
505
image/*;xv %s; test=RunningX; \
425
506
        edit=xpaint %s
426
507
 
427
 
# Convert images to text using the netpbm tools
 
508
<span class="comment"># Convert images to text using the netpbm tools</span>
428
509
image/*;  (anytopnm %s | pnmscale -xysize 80 46 | ppmtopgm | pgmtopbm |
429
510
pbmtoascii -1x2 ) 2&gt;&amp;1 ; copiousoutput
430
511
 
431
 
# Send excel spreadsheets to my NT box
 
512
<span class="comment"># Send excel spreadsheets to my NT box</span>
432
513
application/ms-excel; open.pl %s
433
 
</pre></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="auto-view"></a>4. MIME Autoview</h2></div></div></div><p>
 
514
</pre></div></div><div class="sect1" title="4. MIME Autoview"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="auto-view"></a>4. MIME Autoview</h2></div></div></div><p>
434
515
Usage:
435
 
</p><div class="cmdsynopsis"><p><code class="command">auto-view</code>   
 
516
</p><div class="cmdsynopsis"><p><code class="command">auto_view</code>   
436
517
<em class="replaceable"><code>mimetype</code></em>
437
518
  [
438
519
<em class="replaceable"><code>mimetype</code></em>
439
 
...]<br /><code class="command">unauto-view</code>  { 
 
520
...]<br /><code class="command">unauto_view</code>  { 
440
521
<em class="replaceable"><code>*</code></em>
441
522
  |   
442
523
<em class="replaceable"><code>mimetype</code></em>
443
524
... }</p></div><p>
444
525
In addition to explicitly telling Mutt to view an attachment with the
445
 
MIME viewer defined in the mailcap file, Mutt has support for
446
 
automatically viewing MIME attachments while in the pager.
447
 
</p><p>
448
 
To work, you must define a viewer in the mailcap file which uses the
449
 
<code class="literal">copiousoutput</code> option to denote that it is non-interactive.
450
 
Usually, you also use the entry to convert the attachment to a text
451
 
representation which you can view in the pager.
452
 
</p><p>
453
 
You then use the <span class="command"><strong>auto_view</strong></span> <code class="literal">.muttrc</code> command to list the
454
 
content-types that you wish to view automatically.  For instance, if you
455
 
set it to:
 
526
MIME viewer defined in the mailcap file from the attachments menu, Mutt
 
527
has support for automatically viewing MIME attachments while in the
 
528
pager.
 
529
</p><p>
 
530
For this to work, you must define a viewer in the mailcap file which
 
531
uses the <code class="literal">copiousoutput</code> option to denote that it is
 
532
non-interactive.  Usually, you also use the entry to convert the
 
533
attachment to a text representation which you can view in the pager.
 
534
</p><p>
 
535
You then use the <span class="command"><strong>auto_view</strong></span> configuration command to
 
536
list the content-types that you wish to view automatically.  For
 
537
instance, if you set it to:
456
538
</p><pre class="screen">
457
539
auto_view text/html application/x-gunzip \
458
540
  application/postscript image/gif application/x-tar-gz
459
541
</pre><p>
460
 
Mutt could use the following mailcap entries to automatically view
461
 
attachments of these types.
 
542
...Mutt would try to find corresponding entries for rendering
 
543
attachments of these types as text. A corresponding mailcap could look
 
544
like:
462
545
</p><pre class="screen">
463
546
text/html;      lynx -dump %s; copiousoutput; nametemplate=%s.html
464
547
image/*;        anytopnm %s | pnmscale -xsize 80 -ysize 50 | ppmtopgm | \
467
550
application/x-tar-gz; gunzip -c %s | tar -tf - ; copiousoutput
468
551
application/postscript; ps2ascii %s; copiousoutput
469
552
</pre><p>
470
 
<span class="command"><strong>unauto_view</strong></span> can be used to remove previous entries from the autoview list.
471
 
This can be used with <a class="link" href="configuration.html#message-hook" title="20. Change Settings Before Formatting a Message"><span class="command"><strong>message-hook</strong></span></a> to autoview messages based on size, etc.
472
 
“<span class="quote"><span class="command"><strong>unauto_view</strong></span> *</span>” will remove all previous entries.
473
 
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternative-order"></a>5. MIME Multipart/Alternative</h2></div></div></div><p>
 
553
<span class="command"><strong>unauto_view</strong></span> can be used to remove previous entries
 
554
from the <span class="command"><strong>auto_view</strong></span> list.  This can be used with <a class="link" href="configuration.html#message-hook" title="20. Change Settings Before Formatting a Message"><span class="command"><strong>message-hook</strong></span></a> to
 
555
autoview messages based on size, etc.
 
556
<span class="quote">“<span class="quote"><span class="command"><strong>unauto_view</strong></span> *</span>”</span> will remove all previous
 
557
entries.
 
558
</p></div><div class="sect1" title="5. MIME Multipart/Alternative"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternative-order"></a>5. MIME Multipart/Alternative</h2></div></div></div><p>
 
559
The <code class="literal">multipart/alternative</code> container type only has
 
560
child MIME parts which represent the same content in an alternative
 
561
way. This is often used to send HTML messages which contain an
 
562
alternative plain text representation.
 
563
</p><p>
474
564
Mutt has some heuristics for determining which attachment of a
475
 
<code class="literal">multipart/alternative</code> type to display.  First, Mutt will check the
476
 
<span class="command"><strong>alternative_order</strong></span> list
477
 
to determine if one of the available types is preferred.  It consists of
478
 
a number of mimetypes in order, including support for implicit and
479
 
explicit wildcards, for example:
 
565
<code class="literal">multipart/alternative</code> type to display:
 
566
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
 
567
First, Mutt will check the <span class="command"><strong>alternative_order</strong></span> list to
 
568
determine if one of the available types is preferred.  It consists of a
 
569
number of MIME types in order, including support for implicit and
 
570
explicit wildcards. For example:
480
571
</p><pre class="screen">
481
 
alternative_order text/enriched text/plain text application/postscript image/*
482
 
</pre><p>
483
 
Next, Mutt will check if any of the types have a defined
484
 
<a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, and use that.  Failing
485
 
that, Mutt will look for any text type.  As a last attempt, Mutt will
486
 
look for any type it knows how to handle.
487
 
</p><p>
488
 
To remove a MIME type from the <span class="command"><strong>alternative_order</strong></span> list, use the
489
 
<span class="command"><strong>unalternative_order</strong></span> command.
490
 
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="attachments"></a>6. Attachment Searching and Counting</h2></div></div></div><p>
 
572
alternative_order text/enriched text/plain text \
 
573
  application/postscript image/*
 
574
</pre></li><li class="listitem"><p>
 
575
Next, Mutt will check if any of the types have a defined <a class="link" href="mimesupport.html#auto-view" title="4. MIME Autoview"><span class="command"><strong>auto_view</strong></span></a>, and use that.
 
576
</p></li><li class="listitem"><p>
 
577
Failing that, Mutt will look for any text type.
 
578
</p></li><li class="listitem"><p>
 
579
As a last attempt, Mutt will look for any type it knows how to handle.
 
580
</p></li></ol></div><p>
 
581
To remove a MIME type from the <span class="command"><strong>alternative_order</strong></span>
 
582
list, use the <span class="command"><strong>unalternative_order</strong></span> command.
 
583
</p></div><div class="sect1" title="6. Attachment Searching and Counting"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="attachments"></a>6. Attachment Searching and Counting</h2></div></div></div><p>
491
584
If you ever lose track of attachments in your mailboxes, Mutt's
492
585
attachment-counting and -searching support might be for you.  You can
493
586
make your message index display the number of qualifying attachments in
494
587
each message, or search for messages by attachment count.  You also can
495
588
configure what kinds of attachments qualify for this feature with the
496
 
<span class="command"><strong>attachments</strong></span> and <span class="command"><strong>unattachments</strong></span> commands.
 
589
<span class="command"><strong>attachments</strong></span> and <span class="command"><strong>unattachments</strong></span>
 
590
commands.
497
591
</p><p>
498
 
In order to provide this information, Mutt needs to fully MIME-parse
499
 
all messages affected first. This can slow down operation especially for
 
592
In order to provide this information, Mutt needs to fully MIME-parse all
 
593
messages affected first. This can slow down operation especially for
500
594
remote mail folders such as IMAP because all messages have to be
501
595
downloaded first regardless whether the user really wants to view them
502
 
or not.
 
596
or not though using <a class="xref" href="optionalfeatures.html#body-caching" title="7.2. Body Caching">Section 7.2, “Body Caching”</a> usually means to
 
597
download the message just once.
503
598
</p><p>
504
599
The syntax is:
505
600
</p><div class="cmdsynopsis"><p><code class="command">attachments</code>   
513
608
 <br /><code class="command">attachments</code>   
514
609
<em class="replaceable"><code>?</code></em>
515
610
 </p></div><p>
516
 
<span class="emphasis"><em>disposition</em></span> is the attachment's Content-Disposition type — either
517
 
<code class="literal">inline</code> or <code class="literal">attachment</code>.
518
 
You can abbreviate this to <code class="literal">I</code> or <code class="literal">A</code>.
 
611
<span class="emphasis"><em>disposition</em></span> is the attachment's Content-Disposition
 
612
type — either <code class="literal">inline</code> or
 
613
<code class="literal">attachment</code>.  You can abbreviate this to
 
614
<code class="literal">I</code> or <code class="literal">A</code>.
519
615
</p><p>
520
 
Disposition is prefixed by either a + symbol or a - symbol.  If it's
521
 
a +, you're saying that you want to allow this disposition and MIME
522
 
type to qualify.  If it's a -, you're saying that this disposition
523
 
and MIME type is an exception to previous + rules.  There are examples
 
616
Disposition is prefixed by either a <span class="quote">“<span class="quote">+</span>”</span> symbol or a
 
617
<span class="quote">“<span class="quote">-</span>”</span> symbol.  If it's a <span class="quote">“<span class="quote">+</span>”</span>, you're saying that
 
618
you want to allow this disposition and MIME type to qualify.  If it's a
 
619
<span class="quote">“<span class="quote">-</span>”</span>, you're saying that this disposition and MIME type is
 
620
an exception to previous <span class="quote">“<span class="quote">+</span>”</span> rules.  There are examples
524
621
below of how this is useful.
525
622
</p><p>
526
 
<span class="emphasis"><em>mime-type</em></span> is, unsurprisingly, the MIME type of the attachment you want
527
 
to affect.  A MIME type is always of the format <code class="literal">major/minor</code>, where
528
 
<code class="literal">major</code> describes the broad category of document you're looking at, and
529
 
<code class="literal">minor</code> describes the specific type within that category.  The major
530
 
part of mime-type must be literal text (or the special token “<span class="quote"><code class="literal">*</code></span>”), but
531
 
the minor part may be a regular expression.  (Therefore, “<span class="quote"><code class="literal">*/.*</code></span>” matches
532
 
any MIME type.)
 
623
<span class="emphasis"><em>mime-type</em></span> is the MIME type of the attachment you
 
624
want the command to affect.  A MIME type is always of the format
 
625
<code class="literal">major/minor</code>, where <code class="literal">major</code> describes
 
626
the broad category of document you're looking at, and
 
627
<code class="literal">minor</code> describes the specific type within that
 
628
category.  The major part of mime-type must be literal text (or the
 
629
special token <span class="quote">“<span class="quote"><code class="literal">*</code></span>”</span>), but the minor part
 
630
may be a regular expression.  (Therefore,
 
631
<span class="quote">“<span class="quote"><code class="literal">*/.*</code></span>”</span> matches any MIME type.)
533
632
</p><p>
534
 
The MIME types you give to the <span class="command"><strong>attachments</strong></span> directive are a kind of
535
 
pattern.  When you use the <span class="command"><strong>attachments</strong></span> directive, the patterns you
536
 
specify are added to a list.  When you use <span class="command"><strong>unattachments</strong></span>, the pattern
537
 
is removed from the list.  The patterns are not expanded and matched
538
 
to specific MIME types at this time — they're just text in a list.
539
 
They're only matched when actually evaluating a message.
 
633
The MIME types you give to the <span class="command"><strong>attachments</strong></span> directive
 
634
are a kind of pattern.  When you use the <span class="command"><strong>attachments</strong></span>
 
635
directive, the patterns you specify are added to a list.  When you use
 
636
<span class="command"><strong>unattachments</strong></span>, the pattern is removed from the list.
 
637
The patterns are not expanded and matched to specific MIME types at this
 
638
time — they're just text in a list.  They're only matched when
 
639
actually evaluating a message.
540
640
</p><p>
541
641
Some examples might help to illustrate.  The examples that are not
542
642
commented out define the default configuration of the lists.
543
 
</p><div class="example"><a id="ex-attach-count"></a><p class="title"><b>Example 5.1. Attachment counting</b></p><div class="example-contents"><pre class="screen">
544
 
## Removing a pattern from a list removes that pattern literally. It
545
 
## does not remove any type matching the pattern.
546
 
##
547
 
##  attachments   +A */.*
548
 
##  attachments   +A image/jpeg
549
 
##  unattachments +A */.*
550
 
##
551
 
## This leaves "attached" image/jpeg files on the allowed attachments
552
 
## list. It does not remove all items, as you might expect, because the
553
 
## second */.* is not a matching expression at this time.
554
 
##
555
 
## Remember: "unattachments" only undoes what "attachments" has done!
556
 
## It does not trigger any matching on actual messages.
557
 
 
558
 
 
559
 
## Qualify any MIME part with an "attachment" disposition, EXCEPT for
560
 
## text/x-vcard and application/pgp parts. (PGP parts are already known
561
 
## to mutt, and can be searched for with ~g, ~G, and ~k.)
562
 
##
563
 
## I've added x-pkcs7 to this, since it functions (for S/MIME)
564
 
## analogously to PGP signature attachments. S/MIME isn't supported
565
 
## in a stock mutt build, but we can still treat it specially here.
566
 
##
 
643
</p><div class="example"><a id="ex-attach-count"></a><p class="title"><b>Example 5.2. Attachment counting</b></p><div class="example-contents"><pre class="screen">
 
644
<span class="comment">
 
645
# Removing a pattern from a list removes that pattern literally. It
 
646
# does not remove any type matching the pattern.
 
647
#
 
648
#  attachments   +A */.*
 
649
#  attachments   +A image/jpeg
 
650
#  unattachments +A */.*
 
651
#
 
652
# This leaves "attached" image/jpeg files on the allowed attachments
 
653
# list. It does not remove all items, as you might expect, because the
 
654
# second */.* is not a matching expression at this time.
 
655
#
 
656
# Remember: "unattachments" only undoes what "attachments" has done!
 
657
# It does not trigger any matching on actual messages.
 
658
 
 
659
# Qualify any MIME part with an "attachment" disposition, EXCEPT for
 
660
# text/x-vcard and application/pgp parts. (PGP parts are already known
 
661
# to mutt, and can be searched for with ~g, ~G, and ~k.)
 
662
#
 
663
# I've added x-pkcs7 to this, since it functions (for S/MIME)
 
664
# analogously to PGP signature attachments. S/MIME isn't supported
 
665
# in a stock mutt build, but we can still treat it specially here.
 
666
#
 
667
</span>
567
668
attachments   +A */.*
568
669
attachments   -A text/x-vcard application/pgp.*
569
670
attachments   -A application/x-pkcs7-.*
570
671
 
571
 
## Discount all MIME parts with an "inline" disposition, unless they're
572
 
## text/plain. (Why inline a text/plain part unless it's external to the
573
 
## message flow?)
574
 
##
 
672
<span class="comment">
 
673
# Discount all MIME parts with an "inline" disposition, unless they're
 
674
# text/plain. (Why inline a text/plain part unless it's external to the
 
675
# message flow?)
 
676
</span>
575
677
attachments   +I text/plain
576
678
 
577
 
## These two lines make Mutt qualify MIME containers.  (So, for example,
578
 
## a message/rfc822 forward will count as an attachment.)  The first
579
 
## line is unnecessary if you already have "attach-allow */.*", of
580
 
## course.  These are off by default!  The MIME elements contained
581
 
## within a message/* or multipart/* are still examined, even if the
582
 
## containers themseves don't qualify.
583
 
##
 
679
<span class="comment">
 
680
# These two lines make Mutt qualify MIME containers.  (So, for example,
 
681
# a message/rfc822 forward will count as an attachment.)  The first
 
682
# line is unnecessary if you already have "attach-allow */.*", of
 
683
# course.  These are off by default!  The MIME elements contained
 
684
# within a message/* or multipart/* are still examined, even if the
 
685
# containers themselves don't qualify.
 
686
 
584
687
#attachments  +A message/.* multipart/.*
585
688
#attachments  +I message/.* multipart/.*
 
689
</span>
586
690
 
587
 
## You probably don't really care to know about deleted attachments.
 
691
<span class="comment">## You probably don't really care to know about deleted attachments.</span>
588
692
attachments   -A message/external-body
589
693
attachments   -I message/external-body
590
694
</pre></div></div><br class="example-break" /><p>
591
 
Entering the command “<span class="quote"><span class="command"><strong>attachments</strong></span> ?</span>”
592
 
as a command will list your current settings in Muttrc format, so that
593
 
it can be pasted elsewhere.
594
 
</p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mime-lookup"></a>7. MIME Lookup</h2></div></div></div><p>
 
695
Entering the command <span class="quote">“<span class="quote"><span class="command"><strong>attachments</strong></span> ?</span>”</span> as
 
696
a command will list your current settings in Muttrc format, so that it
 
697
can be pasted elsewhere.
 
698
</p></div><div class="sect1" title="7. MIME Lookup"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mime-lookup"></a>7. MIME Lookup</h2></div></div></div><p>
595
699
Usage:
596
700
</p><div class="cmdsynopsis"><p><code class="command">mime-lookup</code>   
597
701
<em class="replaceable"><code>mimetype</code></em>
602
706
  |   
603
707
<em class="replaceable"><code>mimetype</code></em>
604
708
... }</p></div><p>
605
 
Mutt's mime_lookup list specifies a list of mime-types that should not
606
 
be treated according to their mailcap entry.  This option is designed to
607
 
deal with binary types such as <code class="literal">application/octet-stream</code>.  When an attachment's
608
 
mime-type is listed in mime_lookup, then the extension of the filename will
609
 
be compared to the list of extensions in the <code class="literal">mime.types</code> file.  The mime-type
610
 
associated with this extension will then be used to process the attachment
611
 
according to the rules in the mailcap file and according to any other configuration
612
 
options (such as <span class="command"><strong>auto_view</strong></span>) specified.  Common usage would be:
 
709
Mutt's <span class="command"><strong>mime_lookup</strong></span> list specifies a list of MIME
 
710
types that should <span class="emphasis"><em>not</em></span> be treated according to their
 
711
mailcap entry.  This option is designed to deal with binary types such
 
712
as <code class="literal">application/octet-stream</code>.  When an attachment's
 
713
MIME type is listed in <span class="command"><strong>mime_lookup</strong></span>, then the
 
714
extension of the filename will be compared to the list of extensions in
 
715
the <code class="literal">mime.types</code> file.  The MIME type associated with
 
716
this extension will then be used to process the attachment according to
 
717
the rules in the mailcap file and according to any other configuration
 
718
options (such as <span class="command"><strong>auto_view</strong></span>) specified.  Common usage
 
719
would be:
613
720
</p><pre class="screen">
614
721
mime_lookup application/octet-stream application/X-Lotus-Manuscript
615
722
</pre><p>
616
 
In addition, the <code class="literal">unmime_lookup</code> command may be
617
 
used to disable this feature for any particular mime-type if it had been
618
 
set, for example, in a global <code class="literal">.muttrc</code>.
 
723
In addition, the <code class="literal">unmime_lookup</code> command may be used to
 
724
disable this feature for any particular MIME type if it had been set,
 
725
for example, in a global <code class="literal">.muttrc</code>.
619
726
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="advancedusage.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="optionalfeatures.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Advanced Usage </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Optional Features</td></tr></table></div></body></html>