Next Previous Contents

8. MIME support in VM

8.1. What are VM's MIME capabilities?

Date: June 20, 1998
Updated: February 8, 1999

Since version 6.0, VM has had native MIME reading and sending ability. VM can send and receive MIME messages and digests, decode and encode base64 and quoted-printable, and hand off MIME parts to external display programs.

As of version 6.67, a few flaws remain in VM's MIME abilities:

Be sure to check with the latest version of VM before complaining about the absence of full MIME support: some of these issues may already have been resolved.

8.2 Decoding attachments is very slow. Why?

Date: June 20, 1998
Updated: February 8, 1999

VM can decode base64-encoded and quoted-printable MIME parts internally, but it's much faster to use an external C program to encode and decode encoded attachments.

Most versions of XEmacs come with a utility called mimencode or mmencode which can encode and decode the base64 and quoted-printable encoding. This configuration should work:

(setq vm-mime-base64-decoder-program "mmencode")
(setq vm-mime-base64-decoder-switches '("-b" "-u"))
(setq vm-mime-base64-encoder-program "mmencode")
(setq vm-mime-base64-encoder-switches '("-b"))

If you don't have the `mmencode' program, you can find free C programs which implement base64 and quoted-printable encoding and decoding in the same place you can find VM.

After you download, compile, and install these two programs, set the variables `vm-mime-base64-decoder-program' and `vm-mime-base64-encoder-program' to point to the locations of these programs.

Thanks to Steven Harp for pointing out the existence of `mmencode'.


8.3. How do I extend VM's MIME capabilities so it handles a new MIME type?

Date: June 20, 1998
Updated: February 8, 1999

VM can display MIME content either externally or internally.

Adding an external content type

To add an external display program, add an entry to `vm-mime-external-content-types-alist'. If you have set the variable `vm-mime-internal-content-types' to a list of content-types, you need to make sure that the content-type is not present in it, since the internal content-types are consulted first.

See the documentation for `vm-mime-external-content-types-alist' for more information.

For example, if you want to use metamail to dispatch all your external MIME objects, you should be able to do something like this:

(setq vm-mime-external-content-types-alist
      '((".*" "metamail -c %t -E %e %f")))

Adding an internal content type

In order to display content within emacs, VM needs to know how to convert the content-type into something it can display. The variable `vm-mime-type-converter-alist' allows you to define new conversions and the programs that accomplish them.

See the documentation for `vm-mime-type-converter-alist' for more information.

8.4. How can I read Microsoft Word Documents which are attachments?

Date: June 20, 1998
Updated: February 8, 1999

See also the previous question, about adding MIME types.

If you don't have an application which can read Microsoft Word documents, download and install a .DOC-to-text converter; one such is catdoc, available from

Next, configure Microsoft Word or Microsoft Word Viewer to be launched via `vm-mime-external-type-alist'. For example, if you have the Applix suite, you could do this:

(add-to-list 'vm-mime-external-content-types-alist
             '("application/msword" "applix" "-wp"))

or if using a converter such as catdoc:

(add-to-list 'vm-mime-type-converter-alist
             '("application/msword" "text/plain" "catdoc -"))

8.5. Is there a way to read text/enriched mail?

Date: June 20, 1998

This feature is already in VM 6.30 and later. Click on the MIME attachment and it will be decoded, and the buffer will be reformatted into text/enriched.

8.6. Can I display text/html parts inside VM?

Date: June 20, 1998
Updated: February 22, 2002

Sure. If you have w3 installed, VM will try to use it to display text/html attachments. You could also override VM's behavior by removing "text/html" from `vm-mime-internal-content-types'.

The simplest alternative is to define cat as a converter from text/html to text/plain:

(add-to-list 'vm-mime-type-converter-alist
             '("text/html" "text/plain" "cat"))

If you'd like to remove the tags from the HTML, you might prefer to send the output through striphtml, a perl program by Tom Christiansen. striphtml is available from the Comprehensive Perl Archive Network ( Alternatively, if you have lynx installed, you can use:

lynx -force_html -dump -stdin

To display text/html parts in an external viewer such as Netscape, you'll need the program sendurl, which functions exactly like browse-url-netscape. (Currently, VM's MIME setup won't allow you to specify a lisp function such as browse-url-netscape as an external viewer. You can go ahead and hack in the functionality yourself if you'd like.)

In some older versions of VM (6.35 through 6.50), the code to use emacs w3-mode to internally display text/html parts of MIME messages was commented out. If you have one of those versions of VM, you should upgrade.

8.7. How can I make my PGP-signature be a MIME attachment?

Date: June 20, 1998

Apparently, TM can do this, but there are problems between TM and VM. VM may eventually support this; it may be possible to do it now with tinypgp and some hacking.

8.8. How do I handle uuencoded text?

Date: June 20, 1998
Updated: February 8, 1999

Hold your thumbs (for good luck) and pipe the buffer to uudecode with '|'.

8.9. How do I read x-uuencode attachments?

Date: June 20, 1998

As of VM 6.48, uuencode is recognized as a Content-Transfer-Encoding, and will be decoded like any normal encoding.

If you have an older version of VM, you can manually mark the uuencoded region and pipe it to uudecode with `M-|'.

8.10. How do I prevent text/html (or other MIME types) from being displayed?

Date: December 14, 2000

Quoth Kyle Jones:

A quick tutorial on VM's MIME display variables.

vm-display-using-mime controls whether MIME is displayed specially at all. Default value is t.

vm-auto-decode-mime-messages controls whether a MIME message is decoded when the message is selected. Decoding means parsing the message to figure out what MIME types are in it. This can be slow for large messages, so you might not want it to happen automatically. Default value is t.

vm-auto-displayed-mime-content-types controls which MIME types are displayed immediately after the message is decoded. Default value is ("text" "multipart").

vm-auto-displayed-mime-content-type-exceptions lists exceptions to the auto-displayed types. So you can specify "text" as an auto-displayed type and '("text/html") as the exceptions list to avoid immediate display of text/html. Default value is nil.

So the answer to your question is

(add-to-list 'vm-auto-displayed-mime-content-type-exceptions "text/html")

Next Previous Contents