📄 mimesupport.html
字号:
# Send html to a running netscape by remotetext/html; netscape -remote 'openURL(%s)'; test=RunningNetscape# If I'm not running netscape but I am running X, start netscape on the# objecttext/html; netscape %s; test=RunningX# Else use lynx to view it as texttext/html; lynx %s# This version would convert the text/html to text/plaintext/html; lynx -dump %s; copiousoutput# I use enscript to print text in two columns to a pagetext/*; more %s; print=enscript -2Gr %s# Netscape adds a flag to tell itself to view jpegs internallyimage/jpeg;xv %s; x-mozilla-flags=internal# Use xv to view images if I'm running X# In addition, this uses the \ to extend the line and set my editor# for imagesimage/*;xv %s; test=RunningX; \ edit=xpaint %s# Convert images to text using the netpbm toolsimage/*; (anytopnm %s | pnmscale -xysize 80 46 | ppmtopgm | pgmtopbm |pbmtoascii -1x2 ) 2>&1 ; copiousoutput# Send excel spreadsheets to my NT boxapplication/ms-excel; open.pl %s</pre><p></p></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>In addition to explicitly telling Mutt to view an attachment with theMIME viewer defined in the mailcap file, Mutt has support forautomatically viewing MIME attachments while in the pager.</p><p>To work, you must define a viewer in the mailcap file which uses the <code class="literal">copiousoutput</code> option to denote that it is non-interactive.Usually, you also use the entry to convert the attachment to a textrepresentation which you can view in the pager.</p><p>You then use the <code class="literal">auto_view</code> muttrc command to list thecontent-types that you wish to view automatically.</p><p>For instance, if you set auto_view to:</p><pre class="screen">auto_view text/html application/x-gunzip application/postscript image/gif application/x-tar-gz</pre><p></p><p>Mutt could use the following mailcap entries to automatically viewattachments of these types.</p><pre class="screen">text/html; lynx -dump %s; copiousoutput; nametemplate=%s.htmlimage/*; anytopnm %s | pnmscale -xsize 80 -ysize 50 | ppmtopgm | pgmtopbm | pbmtoascii ; copiousoutputapplication/x-gunzip; gzcat; copiousoutputapplication/x-tar-gz; gunzip -c %s | tar -tf - ; copiousoutputapplication/postscript; ps2ascii %s; copiousoutput</pre><p></p><p>``unauto_view'' can be used to remove previous entries from the autoview list.This can be used with message-hook to autoview messages based on size, etc.``unauto_view *'' will remove all previous entries.</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>Mutt has some heuristics for determining which attachment of amultipart/alternative type to display. First, mutt will check the alternative_order list to determine if one of the available typesis preferred. The alternative_order list consists of a number ofmimetypes in order, including support for implicit and explicitwildcards, for example:</p><pre class="screen">alternative_order text/enriched text/plain text application/postscript image/*</pre><p></p><p>Next, mutt will check if any of the types have a defined <a href="mimesupport.html#auto-view" title="4.聽MIME Autoview">auto_view</a>, and use that. Failingthat, Mutt will look for any text type. As a last attempt, mutt willlook for any type it knows how to handle.</p><p>To remove a MIME type from the <code class="literal">alternative_order</code> list, use the<code class="literal">unalternative_order</code> command.</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>If you ever lose track of attachments in your mailboxes, Mutt'sattachment-counting and -searching support might be for you. You canmake your message index display the number of qualifying attachments ineach message, or search for messages by attachment count. You also canconfigure what kinds of attachments qualify for this feature with theattachments and unattachments commands.</p><p>In order to provide this information, mutt needs to fully MIME-parseall messages affected first. This can slow down operation especially forremote mail folders such as IMAP because all messages have to bedownloaded first regardless whether the user really wants to view themor not.</p><p>The syntax is:</p><pre class="screen">attachments {+|-}disposition mime-typeunattachments {+|-}disposition mime-typeattachments ?</pre><p>Disposition is the attachment's Content-disposition type -- either"inline" or "attachment". You can abbreviate this to I or A.</p><p>Disposition is prefixed by either a + symbolor a - symbol. If it'sa +, you're saying that you want to allow this disposition and MIMEtype to qualify. If it's a -, you're saying that this dispositionand MIME type is an exception to previous + rules. There are examplesbelow of how this is useful.</p><p>Mime-type is, unsurprisingly, the MIME type of the attachment you wantto affect. A MIME type is always of the format "major/minor", where"major" describes the broad category of document you're looking at, and"minor" describes the specific type within that category. The majorpart of mim-type must be literal text (or the special token "*"), butthe minor part may be a regular expression. (Therefore, "*/.*" matchesany MIME type.)</p><p>The MIME types you give to the attachments directive are a kind ofpattern. When you use the attachments directive, the patterns youspecify are added to a list. When you use unattachments, the patternis removed from the list. The patterns are not expanded and matchedto specific MIME types at this time -- they're just text in a list.They're only matched when actually evaluating a message.</p><p>Some examples might help to illustrate. The examples that are notcommented out define the default configuration of the lists.</p><pre class="screen">## Removing a pattern from a list removes that pattern literally. It## does not remove any type matching the pattern.#### attachments +A */.*## attachments +A image/jpeg## unattachments +A */.*#### This leaves "attached" image/jpeg files on the allowed attachments## list. It does not remove all items, as you might expect, because the## second */.* is not a matching expression at this time.#### Remember: "unattachments" only undoes what "attachments" has done!## It does not trigger any matching on actual messages.## Qualify any MIME part with an "attachment" disposition, EXCEPT for## text/x-vcard and application/pgp parts. (PGP parts are already known## to mutt, and can be searched for with ~g, ~G, and ~k.)#### I've added x-pkcs7 to this, since it functions (for S/MIME)## analogously to PGP signature attachments. S/MIME isn't supported## in a stock mutt build, but we can still treat it specially here.##attachments +A */.*attachments -A text/x-vcard application/pgp.*attachments -A application/x-pkcs7-.*## Discount all MIME parts with an "inline" disposition, unless they're## text/plain. (Why inline a text/plain part unless it's external to the## message flow?)##attachments +I text/plain## These two lines make Mutt qualify MIME containers. (So, for example,## a message/rfc822 forward will count as an attachment.) The first## line is unnecessary if you already have "attach-allow */.*", of## course. These are off by default! The MIME elements contained## within a message/* or multipart/* are still examined, even if the## containers themseves don't qualify.###attachments +A message/.* multipart/.*#attachments +I message/.* multipart/.*## You probably don't really care to know about deleted attachments.attachments -A message/external-bodyattachments -I message/external-body</pre><p>"attachments ?" will list your current settings in Muttrc format, sothat it can be pasted elsewhere.</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>Mutt's mime_lookup list specifies a list of mime-types that should notbe treated according to their mailcap entry. This option is designed todeal with binary types such as application/octet-stream. When an attachment'smime-type is listed in mime_lookup, then the extension of the filename willbe compared to the list of extensions in the mime.types file. The mime-typeassociated with this extension will then be used to process the attachmentaccording to the rules in the mailcap file and according to any other configurationoptions (such as auto_view) specified. Common usage would be:</p><pre class="screen">mime_lookup application/octet-stream application/X-Lotus-Manuscript</pre><p></p><p>In addition, the unmime_lookup command may be used to disable this featurefor any particular mime-type if it had been set, for example, in a globalmuttrc.</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="reference.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.聽Reference</td></tr></table></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -