Next: , Previous: Article Treatment, Up: Summary Buffer

3.19 MIME Commands

The following commands all understand the numerical prefix. For instance, 3 K v means “view the third MIME part”.

b
K v
View the MIME part.
K o
Save the MIME part.
K O
Prompt for a file name, then save the MIME part and strip it from the article. The stripped MIME object will be referred via the message/external-body MIME type.
K r
Replace the MIME part with an external body.
K d
Delete the MIME part and add some information about the removed part.
K c
Copy the MIME part.
K e
View the MIME part externally.
K i
View the MIME part internally.
K |
Pipe the MIME part to an external command.

The rest of these MIME commands do not use the numerical prefix in the same manner:

K H
View ‘text/html’ parts of the current article with a WWW browser. Inline images embedded in a message using the cid scheme, as they are generally considered to be safe, will be processed properly. The message header is added to the beginning of every HTML part unless the prefix argument is given.

Warning: Spammers use links to images (using the http scheme) in HTML articles to verify whether you have read the message. As this command passes the HTML content to the browser without eliminating these “web bugs” you should only use it for mails from trusted senders.

If you always want to display HTML parts in the browser, set mm-text-html-renderer to nil.

This command creates temporary files to pass HTML contents including images if any to the browser, and deletes them when exiting the group (if you want).

K b
Make all the MIME parts have buttons in front of them. This is mostly useful if you wish to save (or perform other actions) on inlined parts.
K m
Some multipart messages are transmitted with missing or faulty headers. This command will attempt to “repair” these messages so that they can be viewed in a more pleasant manner (gnus-summary-repair-multipart).
X m
Save all parts matching a MIME type to a directory (gnus-summary-save-parts). Understands the process/prefix convention (see Process/Prefix).
M-t
Toggle the buttonized display of the article buffer (gnus-summary-toggle-display-buttonized).
W M w
Decode RFC 2047-encoded words in the article headers (gnus-article-decode-mime-words).
W M c
Decode encoded article bodies as well as charsets (gnus-article-decode-charset).

This command looks in the Content-Type header to determine the charset. If there is no such header in the article, you can give it a prefix, which will prompt for the charset to decode as. In regional groups where people post using some common encoding (but do not include MIME headers), you can set the charset group/topic parameter to the required charset (see Group Parameters).

W M v
View all the MIME parts in the current article (gnus-mime-view-all-parts).

Relevant variables:

gnus-ignored-mime-types
This is a list of regexps. MIME types that match a regexp from this list will be completely ignored by Gnus. The default value is nil.

To have all Vcards be ignored, you'd say something like this:

          (setq gnus-ignored-mime-types
                '("text/x-vcard"))

gnus-article-loose-mime
If non-nil, Gnus won't require the ‘MIME-Version’ header before interpreting the message as a MIME message. This helps when reading messages from certain broken mail user agents. The default is t.
gnus-article-emulate-mime
There are other, non-MIME encoding methods used. The most common is ‘uuencode’, but yEncode is also getting to be popular. If this variable is non-nil, Gnus will look in message bodies to see if it finds these encodings, and if so, it'll run them through the Gnus MIME machinery. The default is t. Only single-part yEnc encoded attachments can be decoded. There's no support for encoding in Gnus.
gnus-unbuttonized-mime-types
This is a list of regexps. MIME types that match a regexp from this list won't have MIME buttons inserted unless they aren't displayed or this variable is overridden by gnus-buttonized-mime-types. The default value is (".*/.*"). This variable is only used when gnus-inhibit-mime-unbuttonizing is nil.
gnus-buttonized-mime-types
This is a list of regexps. MIME types that match a regexp from this list will have MIME buttons inserted unless they aren't displayed. This variable overrides gnus-unbuttonized-mime-types. The default value is nil. This variable is only used when gnus-inhibit-mime-unbuttonizing is nil.

E.g., to see security buttons but no other buttons, you could set this variable to ("multipart/signed") and leave gnus-unbuttonized-mime-types at the default value.

You could also add "multipart/alternative" to this list to display radio buttons that allow you to choose one of two media types those mails include. See also mm-discouraged-alternatives (see Display Customization).

gnus-inhibit-mime-unbuttonizing
If this is non-nil, then all MIME parts get buttons. The default value is nil.
gnus-article-mime-part-function
For each MIME part, this function will be called with the MIME handle as the parameter. The function is meant to be used to allow users to gather information from the article (e.g., add Vcard info to the bbdb database) or to do actions based on parts (e.g., automatically save all jpegs into some directory).

Here's an example function the does the latter:

          (defun my-save-all-jpeg-parts (handle)
            (when (equal (car (mm-handle-type handle)) "image/jpeg")
              (with-temp-buffer
                (insert (mm-get-part handle))
                (write-region (point-min) (point-max)
                              (read-file-name "Save jpeg to: ")))))
          (setq gnus-article-mime-part-function
                'my-save-all-jpeg-parts)


gnus-mime-multipart-functions
Alist of MIME multipart types and functions to handle them.


gnus-mime-display-multipart-alternative-as-mixed
Display "multipart/alternative" parts as "multipart/mixed".


gnus-mime-display-multipart-related-as-mixed
Display "multipart/related" parts as "multipart/mixed".

If displaying ‘text/html’ is discouraged, see mm-discouraged-alternatives, images or other material inside a "multipart/related" part might be overlooked when this variable is nil. Display Customization.


gnus-mime-display-multipart-as-mixed
Display "multipart" parts as "multipart/mixed". If t, it overrides nil values of gnus-mime-display-multipart-alternative-as-mixed and gnus-mime-display-multipart-related-as-mixed.


mm-file-name-rewrite-functions
List of functions used for rewriting file names of MIME parts. Each function takes a file name as input and returns a file name.

Ready-made functions include
mm-file-name-delete-whitespace, mm-file-name-trim-whitespace, mm-file-name-collapse-whitespace, and mm-file-name-replace-whitespace. The later uses the value of the variable mm-file-name-replace-whitespace to replace each whitespace character in a file name with that string; default value is "_" (a single underscore). The standard functions capitalize, downcase, upcase, and upcase-initials may be useful, too.

Everybody knows that whitespace characters in file names are evil, except those who don't know. If you receive lots of attachments from such unenlightened users, you can make live easier by adding

          (setq mm-file-name-rewrite-functions
                '(mm-file-name-trim-whitespace
                  mm-file-name-collapse-whitespace
                  mm-file-name-replace-whitespace))

to your ~/.gnus.el file.