Next: Flags, Previous: Multiple Folders, Up: Commands
The Multipurpose Internet Mail Extensions (MIME) define a standard means for structuring mail messages. MIME permits a message to have multiple parts, each of which is called an entity. It also provides a way to associate type information with each entity. For example, an ordinary text message has type `text/plain', HTML has type `text/html', and a JPEG image has type `image/jpeg'. Additionally, MIME entities may be annotated to indicate whether they should be shown in-line, or whether they are attachments that should be shown only upon further user action.
IMAIL provides simple support for MIME messages. MIME attachments are shown in the IMAIL buffer by special abbreviations. You can write an attachment to a file. Multipart MIME structures are recognized and displayed in a clean format that suppresses unnecessary clutter. And MIME encodings such as quoted-printable and base64 are automatically decoded prior to displaying the message or saving the attachment.
End-user formatting of MIME messages is a complex process, partly because these messages can be arbitrarily complex in their internal structure. IMAIL provides several variables that give you some control over the formatting prcess.
Many MIME messages have multiple parts; for example, a message
with an attachment normally contains at least two parts: the message
text and the attachment. IMAIL separates the different parts
of a MIME message with specially-formatted lines. There are
several styles of separator lines available, selected by changing the
value of the variable imail-mime-boundary-style
. The default
value of simple
means to use long lines of hyphen characters as
the separator lines. A value of sgml
means use long lines of
hyphens that are wrapped with `<!--' and `-->', which makes
them valid SGML comments. A value of original
means to
use the original MIME boundaries, which have certain
useful syntactic properties but are not as visually distinctive.
MIME also specifies a particular kind of multipart message, of
type `multipart/alternative', in which the parts are different
representations of the same message. A typical example of this is a
mailer that sends both plain text and HTML versions of the
message text. Normally IMAIL shows only the simplest of these
parts (which is almost always plain text) and suppresses the
alternatives. However, if you set the variable
imail-mime-show-alternatives
to #t
, IMAIL will
show these alternative forms as attachments.
Another kind of multipart MIME message is the digest message,
which has type `multipart/digest'. Digest messages are normally
used by high-volume mailing lists to reduce the number of messages sent
to the end user; instead the user receives one message containing all of
the messages from that list in a particular time period, usually a day.
IMAIL can present MIME digest messages in one of two
formats. The default format is to show all of the component messages of
the digest as attachments. This is particularly useful for large
digests that you will only read a few messages from, since you can scan
the digest contents for interesting messages without downloading all of
the messages in the digest. In the alternative format, selected by
setting imail-mime-collapse-digest
to #f
, the component
messages of a digest are all shown inline.
As a general rule, any MIME entity that contains non-textual information is displayed as an attachment. Attachments are normally shown as specially-formatted abbreviations. Here is an example:
<imail-part name="foo.doc" type="application/msword" length="55499" />
This shows various things about the attachment, including its (optional) name, its MIME type, and the length of the attachment in bytes. (The length is computed on the encoded form of the attachment, and is generally slightly larger than the decoded length.)
IMAIL uses somewhat more complicated rules for deciding when a MIME entity is displayed in this abbreviated format, and when it is expanded in line. In general, all non-text entities are abbreviated. Additionally, if a text entity is given a MIME disposition of `attachment', if the character set of the entity is unknown, if the encoding type is unknown, or if the subtype is unknown, it is abbreviated.
Two variables control the abbreviation of text entities.
imail-known-mime-charsets
is a list of regular expressions that
specify the known character sets; by default it specifies
US-ASCII, the ISO 8859 character sets, and some
random but commonly-seen Microsoft Windows character sets. The variable
imail-inline-mime-text-subtypes
contains a list of symbols, each
of which is the name of a text subtype that should be shown in line.
For example, if the symbol html
is in this list, then
MIME parts of type text/html
are shown in-line. Text
subtypes not appearing in this list are abbreviated as attachments.
Here are IMAIL's MIME-specific commands:
imail-save-attachment
).
imail-save-mime-entity
).
imail-toggle-mime-entity
).
The primary MIME command is C-o
(imail-save-attachment
), which saves a single attachment to a
file. If point is on an attachment, that is the attachment to be saved,
otherwise IMAIL prompts for an attachment by name. If a
prefix argument is specified, prompting is performed even if point is on
an attachment. Once the attachment is determined, IMAIL
prompts for the name of a file to save the attachment to. The filename
is initialized from the name specified by the attachment, if any. The
directory of the filename is initialized to the directory in which the
last attachment was saved, or the user's home directory if no
attachments have previously been saved.
If you want to save attachments to a specific directory, change the
variable imail-mime-attachment-directory
to contain the name of
that directory.
The command w (imail-save-mime-entity
) is similar to
imail-save-attachment
except that it will save any MIME
entity, not just an attachment. For example, this allows you to save
the message text. This command saves the entity that point is on; if
point is not on any entity, an error is signalled. If the entity is
encoded, e.g. with quoted-printable or base64 encoding, it is decoded
before it is saved. If the entity is text, it is written to the file in
text mode (relevant only under Windows and OS/2); otherwise it is
written in binary mode.
A simpler way to save a MIME entity is to point at the entity
with the mouse and click the right button
(imail-mouse-save-mime-entity
). This works the same way as
imail-save-mime-entity
except that the entity is selected by the
mouse instead of point.
The command C-c C-t C-e (imail-toggle-mime-entity
) is
similar to imail-save-mime-entity
, except that instead of saving
the entity to a file, it toggles whether the entity is shown in-line or
in abbreviated form. A common situation in which this is useful is when
the text of a message is in an unknown character set. In this case,
IMAIL by default shows the text in abbreviated form; use
C-t to expand it in place.