Page Contents

Introduction to MIME

MIME (Multipurpose Internet Mail Extensions) is a way of extending the normal capabilities of internet mail (and news) by describing a format that can be used to encode more than just plain text in messages. Messages in MIME format conform to the standards use to send plain text messages (RFC 822), but are able to encode all kinds of other data, like images, sounds, text in different languages etc. It does this by converting those different data types into a plain text form.

This chapter does not attempt to give comprehensive coverage of the MIME standard, but to give you enough information to understand the impact of MIME on sending and receiving messages in MT-NewsWatcher.

The official MIME format is documented in the RFCs (Requests for Comments):

  1. RFC 2045 Part One: Format of Internet Message Bodies
  2. RFC 2046 Part Two: Media Types
  3. RFC 2047 Part Three: Message Header Extensions for Non-ASCII Text
  4. RFC 2048 Part Four: Registration Procedures
  5. RFC 2049 Part Five: Conformance Criteria and Examples

Of most relevence to the format of news articles are Parts One and Three.

The MIME standard describes a number of features of MIME which make it possible to describe multimedia context in a plain text form:

Standardized message headers

Messages sent with MIME must contain certain headers that describe the version of MIME being used, and a description of how the contents of the message are encoded. For example, a news posting in MIME format might contain:

Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

These headers state that the message conforms to the RFC 2045, that the content is plain text using the Western Latin 1 character set, and that the contents were not transformed for sending, and may be safely transmitted over a 7-bit channel.

Media types

The Content-Type header for a section describes the contents of that section using a two-part media type description. Examples are "text/plain", "text/html", "image/jpeg", "video/quicktime". A decoding agent (like MT-NewsWatcher) can use this description to choose how to handle the contents of that section.

Encoding types

MIME supplies a number of ways of transforming text and other data so that it can be safely transmitted over legacy transport systems (like email). These value are supplied in the Content-Transfer-Encoding header. Briefly, these are:

7bit, 8bit or binary
These values indicate that no encoding was used for the section contents, but describe the nature of the enclosed data. 7bit and 8bit is used for line-based text which does not, or does contain 8-bit (high ASCII) characters. A value of binary indicates that the data is not line-based (ie. does not contain line termination characters to wrap lines of text to a reasonable width).
The Quoted-Printable encoding is used for text that is mostly printable ASCII text, but which may contain high ASCII characters, or unwrapped lines. Characters that need to be encoded are replaced with their value like =A0, and lines are soft-wrapped by inserting = characters.
The Base64 encoding is used for binary data, like images, sounds etc. The binary data is encoded in a sequence of characters according to some simple rules, to give text that looks like:
This data can be decoded back to the original binary data on the recieving end.
Message compartmentalization

To allow MIME messages to contain different types of data (text, and an image, say), the message can be broken up into sections, so that each section contains one data type as described by its Content-Type header. Related sections can be grouped together, or sections can contain alternative representations of the same data so that clients can choose one that they are able to best display. For example, a MIME message can contain both plain text and HTML versions of the message body, wrapped in a multipart/alternative section. If you view this message in MT-NewsWatcher, you'll see the plain text part, whereas viewing it in Netscape Communicator would show you the HTML part.

Here's an example of a message with two subsections in a multipart/mixed section. The various parts have been color-coded, showing how each section has headers that describe its contents. This shows the text of the article as it appears on the server. MT-NewsWatcher decodes this for you, so you should never see these details.

From: Simon Fraser <> Newsgroups: alt.test Subject: Crow music image - crow-music.gif (1/1) Date: Sun, 05 Sep 1999 20:31:47 -0700 Message-ID: <> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------UYHRtC0I5LhA" This is a multi-part message in MIME format. --------------UYHRtC0I5LhA Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Here is a funny picture. Simon --------------UYHRtC0I5LhA Content-Type: image/gif; name="crow-music.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="crow-music.gif" R0lGODlhZABkAPcAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABm MwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/ ... wOOX8EBWr7xZjkiPsYZL0FM51pGMdaI7GhW5FsiWwYZSGKybrYr4RDa27jMsiKQkPeYaSVry kpjMZCTZFpwpUoQ6VgKMJjPpxpmM8pSotKT1PskTSXaSbamMJQsKKUggthKTHZolpKzIS5EE --------------UYHRtC0I5LhA--

Note that the message is divided into sections, with the boundaries between sections marked by the string --------------UYHRtC0I5LhA. The first section is the plain text body of the message, and the second part is a Base64 encoded GIF file.

Receiving MIME Messages

When MT-NewsWatcher receives an article in MIME format, it can parse the message contents, and detect and decode the various sections as appropriate. It will decode Quoted-Printable sections, handles multiple sections with different character sets in a message, and decode Base64-encoded binaries. Horizontal divider lines are inserted between each section. Here's an example of a message with three binary attachments:

An artice in MIME format

For multipart/alternative sections, MT-NewsWatcher chooses the section that it can best display. For the most common case, plain text and HTML, it will display the plain text.

Viewing HTML

MT-NewsWatcher cannot currently display HTML. When it encounters an HTML section with no plain text alternative, it will display the raw HTML. You can view the HTML in a browser by using the View HTML in Browser command on the context menu.

Tip: You can also view the HTML in a browser by command-clicking on the first <HTML> tag as if it were a URL.

Viewing Binaries

When MT-NewsWatcher encounters a MIME section that contains Base64 text, it decodes that into binary form. It then tries to find a plugin in the NewsWatcher Plugins folder that can handle this kind of binary file, by looking at the file name extension for the encoded binary. If it finds a plugin that can handle the data, it feeds the binary data to the plugin for display. If no plugin is found that can handle the data, the encoded binary shows up as a file icon in the article body (like the MP3 and Stuffit archive icons in the screenshot above).

For more information about handling and saving encoded binaries, see the chapter on Binaries.

Sending Message with MIME

When the preference is set to send messages with MIME formatting (Send with MIME checkbox in the Message options preferences panel), MT-NewsWatcher will use MIME in outgoing email and news messages. This section describes the implications of using MIME for sending.

Note: It is recommended that you turn this option on, as MIME information allows other news clients to do a better job of displaying articles that you send, particularly if you send using a character set other than ISO-8859-1.

Sending Attached Binaries

When sending with MIME, you get some slightly different options when attaching files to an outgoing message. These differences are described in detail in the section on posting binaries. When MIME is on, data will be sent encoding with Base64. If you are sending a Macintosh file, and need to send the resource fork too, you also get the option of sending in AppleSingle or AppleDouble format (these formats include the resource fork of the file being attached). You can encode files with BinHex when sending MIME, but this is not recommended.

When sending a message with one or more attached files, MT-NewsWatcher sends a message with a body which is a multipart/mixed section. Within this, the text of the message, and your signature, is included as a text/plain section. Following that are one or more sections for the binaries, which will have appropriate MIME types for the type of binary being sent. The MIME type is derived from the file extension, using Internet Config file mapping settings.

Multipart Messages and MIME

If you send a message with attached binaries in multiple sections, MT-NewsWatcher uses the MIME message/partial format. This is a way of describing content that is split across multiple messages, and allows receiving agents to reassemble the parts in the correct order.

Header Encoding with MIME

If you are sending MIME messages in a character set other than Western Latin 1 (ISO-8859-1), then MT-NewsWatcher will encode the textual headers of the message, if necessary, according to the rules described in RFC 2047. In this encoding, non-ASCII characters are encoded with either Quoted-Printable or Base64 encoding so that the headers don't get corrupted in sending. For example, a message with a subject line of

Subject: Flambé

would be sent encoded as

Subject: =?ISO-8859-1?Q?Flamb=E9?=

This kind of encoding may not be welcome in some groups, in which case you should disable sending with MIME when posting to such groups.

More information on sending with different character sets is provided in the chapter on International Language Support.

Table of Contents