X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..6c6f0d10745f764586b8689fecfbea955ba501dc:/doc/mimesupport.html diff --git a/doc/mimesupport.html b/doc/mimesupport.html index 44fda22..21fcf0f 100644 --- a/doc/mimesupport.html +++ b/doc/mimesupport.html @@ -1,27 +1,31 @@ -Chapter 5. Mutt's MIME Support

Chapter 5. Mutt's MIME Support

Table of Contents

1. Using MIME in Mutt
1.1. Viewing MIME messages in the pager
1.2. The Attachment Menu
1.3. The Compose Menu
2. MIME Type configuration with mime.types
3. MIME Viewer configuration with mailcap
3.1. The Basics of the mailcap file
3.2. Secure use of mailcap
3.3. Advanced mailcap Usage
3.4. Example mailcap files
4. MIME Autoview
5. MIME Multipart/Alternative
6. Attachment Searching and Counting
7. MIME Lookup

+

Chapter 5. Mutt's MIME Support

Quite a bit of effort has been made to make Mutt the premier text-mode MIME MUA. Every effort has been made to provide the functionality that the discerning MIME user requires, and the conformance to the standards @@ -34,7 +38,7 @@ the external commands to use for handling specific MIME types. There are three areas/menus in Mutt which deal with MIME, they are the pager (while viewing a message), the attachment menu and the compose menu. -

1.1. Viewing MIME messages in the pager

+

1.1. Viewing MIME Messages in the Pager

When you select a message from the index and view it in the pager, Mutt decodes the message to a text representation. Mutt internally supports a number of MIME types, including text/plain, text/enriched, @@ -56,12 +60,12 @@ If Mutt cannot deal with a MIME type, it will display a message like:

 [-- image/gif is unsupported (use 'v' to view this part) --]
 

1.2. The Attachment Menu

-The default binding for view-attachments is `v', which displays the +The default binding for <view-attachments> is “v”, which displays the attachment menu for a message. The attachment menu displays a list of the attachments in a message. From the attachment menu, you can save, print, pipe, delete, and view attachments. You can apply these operations to a group of attachments at once, by tagging the attachments -and by using the “tag-prefix” operator. You can also reply to the +and by using the <tag-prefix> operator. You can also reply to the current message from this menu, and only the current attachment (or the attachments tagged) will be quoted in your reply. You can view attachments as text, or view them using the mailcap viewer definition. @@ -88,23 +92,23 @@ Attachments appear as follows:

The '-' denotes that Mutt will delete the file after sending (or postponing, or canceling) the message. It can be toggled with the -toggle-unlink command (default: u). The next field is the MIME -content-type, and can be changed with the edit-type command +<toggle-unlink> command (default: u). The next field is the MIME +content-type, and can be changed with the <edit-type> command (default: ^T). The next field is the encoding for the attachment, which allows a binary message to be encoded for transmission on 7bit -links. It can be changed with the edit-encoding command +links. It can be changed with the <edit-encoding> command (default: ^E). The next field is the size of the attachment, rounded to kilobytes or megabytes. The next field is the filename, -which can be changed with the rename-file command (default: R). +which can be changed with the <rename-file> command (default: R). The final field is the description of the attachment, and can be -changed with the edit-description command (default: d). -

2. MIME Type configuration with mime.types

+changed with the <edit-description> command (default: d). +

2. MIME Type Configuration with mime.types

When you add an attachment to your mail message, Mutt searches your -personal mime.types file at ${HOME}/.mime.types, and then -the system mime.types file at /usr/local/share/mutt/mime.types or +personal mime.types file at ${HOME}/.mime.types, and then +the system mime.types file at /usr/local/share/mutt/mime.types or /etc/mime.types

-The mime.types file consist of lines containing a MIME type and a space +The mime.types file consist of lines containing a MIME type and a space separated list of extensions. For example:

 application/postscript          ps eps
@@ -119,23 +123,23 @@ attach, it will look at the file.  If the file is free of binary
 information, Mutt will assume that the file is plain text, and mark it
 as text/plain.  If the file contains binary information, then Mutt will
 mark it as application/octet-stream.  You can change the MIME
-type that Mutt assigns to an attachment by using the edit-type
+type that Mutt assigns to an attachment by using the <edit-type>
 command from the compose menu (default: ^T). The MIME type is actually a
 major mime type followed by the sub-type, separated by a '/'. 6 major
 types: application, text, image, video, audio, and model have been approved
 after various internet discussions. Mutt recognizes all of these if the
-appropriate entry is found in the mime.types file. It also recognizes other
+appropriate entry is found in the mime.types file. It also recognizes other
 major mime types, such as the chemical type that is widely used in the
 molecular modeling community to pass molecular data in various forms to
 various molecular viewers. Non-recognized mime types should only be used
 if the recipient of the message is likely to be expecting such attachments.
-

3. MIME Viewer configuration with mailcap

+

3. MIME Viewer Configuration with Mailcap

Mutt supports RFC 1524 MIME Configuration, in particular the Unix specific format specified in Appendix A of RFC 1524. This file format is commonly referred to as the mailcap format. Many MIME compliant programs utilize the mailcap format, allowing you to specify handling for all MIME types in one place for all programs. Programs known to -use this format include Netscape, XMosaic, lynx and metamail. +use this format include Firefox, lynx and metamail.

In order to handle various MIME types that Mutt can not handle internally, Mutt parses a series of external configuration files to @@ -144,7 +148,7 @@ is a colon delimited list containing the following files:

  1. $HOME/.mailcap

  2. $PKGDATADIR/mailcap

  3. $SYSCONFDIR/mailcap

  4. /etc/mailcap

  5. /usr/etc/mailcap

  6. /usr/local/etc/mailcap

where $HOME is your home directory. The $PKGDATADIR and the -$SYSCONFDIR directories depend on where mutt +$SYSCONFDIR directories depend on where Mutt is installed: the former is the default for shared data, the latter for system configuration files.

@@ -156,7 +160,7 @@ mutt -nF /dev/null -Q mailcap_path In particular, the metamail distribution will install a mailcap file, usually as /usr/local/etc/mailcap, which contains some baseline entries. -

3.1. The Basics of the mailcap file

+

3.1. The Basics of the Mailcap File

A mailcap file consists of a series of lines which are comments, blank, or definitions.

@@ -222,13 +226,13 @@ text/html; lynx %s text/*; more

This is the simplest form of a mailcap file. -

3.2. Secure use of mailcap

+

3.2. Secure Use of Mailcap

The interpretation of shell meta-characters embedded in MIME parameters can lead to security problems in general. Mutt tries to quote parameters in expansion of %s syntaxes properly, and avoids risky characters by -substituting them, see the $mailcap_sanitize variable. +substituting them, see the $mailcap_sanitize variable.

-Although mutt's procedures to invoke programs with mailcap seem to be +Although Mutt's procedures to invoke programs with mailcap seem to be safe, there are other applications parsing mailcap, maybe taking less care of it. Therefore you should pay attention to the following rules:

@@ -248,7 +252,7 @@ since it is not itself subject to any further expansion):

 text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \
         && test "`echo $charset | tr '[A-Z]' '[a-z]'`" != iso-8859-1
-

3.3. Advanced mailcap Usage

3.3.1. Optional Fields

+

3.3. Advanced Mailcap Usage

3.3.1. Optional Fields

In addition to the required content-type and view command fields, you can add semi-colon ';' separated fields to set flags and other options. Mutt recognizes the following optional fields: @@ -265,11 +269,11 @@ text/html; lynx -dump %s ; copiousoutput This will cause lynx to format the text/html output as text/plain and Mutt will use your standard pager to display the results.

needsterminal

-Mutt uses this flag when viewing attachments with auto_view, in order to decide whether it should honor the setting -of the $wait_key variable or +Mutt uses this flag when viewing attachments with auto_view, in order to decide whether it should honor the setting +of the $wait_key variable or not. When an attachment is viewed using an interactive program, and the corresponding mailcap entry has a needsterminal flag, Mutt will use -$wait_key and the exit status +$wait_key and the exit status of the program to decide if it will ask you to press a key after the external program has exited. In all other situations it will not prompt you for a key. @@ -279,7 +283,7 @@ specific MIME type. Mutt supports this from the compose menu.

composetyped=<command>

This flag specifies the command to use to create a new attachment of a specific MIME type. This command differs from the compose command in -that mutt will expect standard MIME headers on the data. This can be +that Mutt will expect standard MIME headers on the data. This can be used to specify parameters, filename, description, etc. for a new attachment. Mutt supports this from the compose menu.

print=<command>

@@ -308,14 +312,14 @@ then the test failed, and Mutt continues searching for the right entry. Note that the content-type must match before Mutt performs the test. For example:

-text/html; netscape -remote 'openURL(%s)' ; test=RunningX
+text/html; firefox -remote 'openURL(%s)' ; test=RunningX
 text/html; lynx %s
 

In this example, Mutt will run the program RunningX which will return 0 if the X Window manager is running, and non-zero if it isn't. If -RunningX returns 0, then Mutt will call netscape to display the -text/html object. If RunningX doesn't return 0, then Mutt will go on -to the next entry and use lynx to display the text/html object. +RunningX returns 0, then Mutt will call firefox to display the +text/html object. If RunningX doesn't return 0, then Mutt will go on +to the next entry and use lynx to display the text/html object.

3.3.2. Search Order

When searching for an entry in the mailcap file, Mutt will search for the most useful entry for its purpose. For instance, if you are @@ -330,24 +334,24 @@ image/gif; ; print= anytopnm %s | pnmtops | lpr; \ Mutt will skip the image/* entry and use the image/gif entry with the print command.

-In addition, you can use this with auto_view +In addition, you can use this with auto_view to denote two commands for viewing an attachment, one to be viewed automatically, the other to be viewed interactively from the attachment menu. In addition, you can then use the test feature to determine which viewer to use interactively depending on your environment.

-text/html;      netscape -remote 'openURL(%s)' ; test=RunningX
+text/html;      firefox -remote 'openURL(%s)' ; test=RunningX
 text/html;      lynx %s; nametemplate=%s.html
 text/html;      lynx -dump %s; nametemplate=%s.html; copiousoutput
 

-For auto_view, Mutt will choose the third +For auto_view, Mutt will choose the third entry because of the copiousoutput tag. For interactive viewing, Mutt will run the program RunningX to determine if it should use the first entry. If the program returns non-zero, Mutt will use the second entry for interactive viewing.

3.3.3. Command Expansion

The various commands defined in the mailcap files are passed to the -/bin/sh shell using the system() function. Before the +/bin/sh shell using the system(3) function. Before the command is passed to /bin/sh -c, it is parsed to expand various special parameters with information from Mutt. The keywords Mutt expands are: @@ -379,15 +383,15 @@ This will be replaced by a % Mutt does not currently support the %F and %n keywords specified in RFC 1524. The main purpose of these parameters is for multipart messages, which is handled internally by Mutt. -

3.4. Example mailcap files

+

3.4. Example Mailcap Files

This mailcap file is fairly simple and standard:

 # I'm always running X :)
 video/*;        xanim %s > /dev/null
 image/*;        xv %s > /dev/null
 
-# I'm always running netscape (if my computer had more memory, maybe)
-text/html;      netscape -remote 'openURL(%s)'
+# I'm always running firefox (if my computer had more memory, maybe)
+text/html;      firefox -remote 'openURL(%s)'
 

This mailcap file shows quite a number of examples:

@@ -395,12 +399,12 @@ This mailcap file shows quite a number of examples:
 # send that to /dev/null so I don't see it
 video/*;        xanim %s > /dev/null
 
-# Send html to a running netscape by remote
-text/html;      netscape -remote 'openURL(%s)'; test=RunningNetscape
+# Send html to a running firefox by remote
+text/html;      firefox -remote 'openURL(%s)'; test=RunningFirefox
 
-# If I'm not running netscape but I am running X, start netscape on the
+# If I'm not running firefox but I am running X, start firefox on the
 # object
-text/html;      netscape %s; test=RunningX
+text/html;      firefox %s; test=RunningX
 
 # Else use lynx to view it as text
 text/html;      lynx %s
@@ -411,7 +415,7 @@ text/html;      lynx -dump %s; copiousoutput
 # I use enscript to print text in two columns to a page
 text/*;         more %s; print=enscript -2Gr %s
 
-# Netscape adds a flag to tell itself to view jpegs internally
+# Firefox adds a flag to tell itself to view jpegs internally
 image/jpeg;xv %s; x-mozilla-flags=internal
 
 # Use xv to view images if I'm running X
@@ -427,6 +431,16 @@ pbmtoascii -1x2 ) 2>&1 ; copiousoutput
 # Send excel spreadsheets to my NT box
 application/ms-excel; open.pl %s
 

4. MIME Autoview

+Usage: +

auto-view +mimetype + [ +mimetype +...]
unauto-view { +* + | +mimetype +... }

In addition to explicitly telling Mutt to view an attachment with the MIME viewer defined in the mailcap file, Mutt has support for automatically viewing MIME attachments while in the pager. @@ -436,10 +450,9 @@ To work, you must define a viewer in the mailcap file which uses the Usually, you also use the entry to convert the attachment to a text representation which you can view in the pager.

-You then use the auto_view muttrc command to list the -content-types that you wish to view automatically. -

-For instance, if you set auto_view to: +You then use the auto_view .muttrc command to list the +content-types that you wish to view automatically. For instance, if you +set it to:

 auto_view text/html application/x-gunzip \
   application/postscript image/gif application/x-tar-gz
@@ -454,47 +467,53 @@ application/x-gunzip;   gzcat; copiousoutput
 application/x-tar-gz; gunzip -c %s | tar -tf - ; copiousoutput
 application/postscript; ps2ascii %s; copiousoutput
 

-“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. +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.

5. MIME Multipart/Alternative

Mutt has some heuristics for determining which attachment of a -multipart/alternative type to display. First, mutt will check the -alternative_order list to determine if one of the available types -is preferred. The alternative_order list consists of a number of -mimetypes in order, including support for implicit and explicit -wildcards, for example: +multipart/alternative type to display. First, Mutt will check the +alternative_order list +to determine if one of the available types is preferred. It consists of +a number of mimetypes in order, including support for implicit and +explicit wildcards, for example:

 alternative_order text/enriched text/plain text application/postscript image/*
 

-Next, mutt will check if any of the types have a defined -auto_view, and use that. Failing -that, Mutt will look for any text type. As a last attempt, mutt will +Next, Mutt will check if any of the types have a defined +auto_view, and use that. Failing +that, Mutt will look for any text type. As a last attempt, Mutt will look for any type it knows how to handle.

-To remove a MIME type from the alternative_order list, use the -unalternative_order command. +To remove a MIME type from the alternative_order list, use the +unalternative_order command.

6. Attachment Searching and Counting

If you ever lose track of attachments in your mailboxes, Mutt's attachment-counting and -searching support might be for you. You can make your message index display the number of qualifying attachments in each message, or search for messages by attachment count. You also can configure what kinds of attachments qualify for this feature with the -attachments and unattachments commands. +attachments and unattachments commands.

-In order to provide this information, mutt needs to fully MIME-parse +In order to provide this information, Mutt needs to fully MIME-parse all messages affected first. This can slow down operation especially for remote mail folders such as IMAP because all messages have to be downloaded first regardless whether the user really wants to view them or not.

The syntax is: -

-attachments   {+|-}disposition mime-type
-unattachments {+|-}disposition mime-type
-attachments   ?
-

-Disposition is the attachment's Content-disposition type -- either +

attachments +{ + | - }disposition + +mime-type +
unattachments +{ + | - }disposition + +mime-type +
attachments +? +

+disposition is the attachment's Content-Disposition type — either inline or attachment. You can abbreviate this to I or A.

@@ -504,7 +523,7 @@ type to qualify. If it's a -, you're saying that this disposition and MIME type is an exception to previous + rules. There are examples below of how this is useful.

-Mime-type is, unsurprisingly, the MIME type of the attachment you want +mime-type is, unsurprisingly, the MIME type of the attachment you want to 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 major @@ -512,11 +531,11 @@ part of mime-type must be literal text (or the special token “*/.*” matches any MIME type.)

-The MIME types you give to the attachments directive are a kind of -pattern. When you use the attachments directive, the patterns you -specify are added to a list. When you use unattachments, the pattern +The MIME types you give to the attachments directive are a kind of +pattern. When you use the attachments directive, the patterns you +specify are added to a list. When you use unattachments, the pattern is removed from the list. The patterns are not expanded and matched -to specific MIME types at this time -- they're just text in a list. +to specific MIME types at this time — they're just text in a list. They're only matched when actually evaluating a message.

Some examples might help to illustrate. The examples that are not @@ -569,22 +588,32 @@ attachments +I text/plain attachments -A message/external-body attachments -I message/external-body


-Entering the command “attachments ?” +Entering the command “attachments ?” as a command will list your current settings in Muttrc format, so that it can be pasted elsewhere.

7. MIME Lookup

+Usage: +

mime-lookup +mimetype + [ +mimetype +...]
unmime-lookup { +* + | +mimetype +... }

Mutt's mime_lookup list specifies a list of mime-types that should not be treated according to their mailcap entry. This option is designed to -deal with binary types such as application/octet-stream. When an attachment's +deal with binary types such as application/octet-stream. When an attachment's mime-type is listed in mime_lookup, then the extension of the filename will -be compared to the list of extensions in the mime.types file. The mime-type +be compared to the list of extensions in the mime.types file. The mime-type associated with this extension will then be used to process the attachment according to the rules in the mailcap file and according to any other configuration -options (such as auto_view) specified. Common usage would be: +options (such as auto_view) specified. Common usage would be:

 mime_lookup application/octet-stream application/X-Lotus-Manuscript
 

-In addition, the unmime_lookup command may be used to disable this feature -for any particular mime-type if it had been set, for example, in a global -muttrc. -

+In addition, the unmime_lookup command may be +used to disable this feature for any particular mime-type if it had been +set, for example, in a global .muttrc. +