MIME(5) DG/UX R4.11MU05 MIME(5)
NAME
MIME - Multi-Purpose Internet Mail Extensions
DESCRIPTION
MIME is a set of tools and mail support utilities that allow mail
messages to contain graphics, sound, "rich text" (text containing
bold or italic text), postscript files, other 8-bit files (e.g.,
binaries) and regular text; a MIME mail message may contain any
combination of these.
MIME is quickly becoming a standard for Internet mail, and an
increasing number of office automation products and email systems are
making use of MIME functionality. The DG/UX system uses the MIME
support as provided in UNIX System V Release 4.2 Multiprocessor (UNIX
SVR4.2 MP).
With MIME support in the DG/UX system, vendors and tool-writers can
create and port products that can generate and send MIME messages as
well as receive and read them. User tools for sending and receiving
MIME messages are also provided; these tools are rudimentary but
provide a reasonable interface. They are described below.
This man page discusses:
· utilities for creating products that support MIME
· a brief description of each of the MIME utilities provided
· how MIME usage can be configured by the system administrator
(or the user)
· user commands for sending and reading messages in MIME format
· a brief discussion of the encoding and decoding schemes used
by MIME
· a description of additional mail headers that are used in MIME
messages
Underlying Support
A set of utilities is provided so that tools or products may include
MIME support. Though these utilities may be called by the user, they
are primarily intended to be used by email or office automation
products. These are described below and include: extcompose,
getfilename, mailproc, mailto, mailR, mimencode, mimeto7bit,
metamail, metasend, rewrite, richtext, showexternal, shownonascii,
showpartial, showpicture, and splitmail.
Brief Synopsis of MIME Commands and Utilities
Each of the items in this section has a more detailed man page that
may be read for further information. MIME-related commands,
utilities, and files provided in the DG/UX system are:
· mailcap: The file mailcap is the key to how MIME support is
configured in the DG/UX system. This file is used by mail
senders to determine how to generate a particular "object" to
include in a MIME message, e.g., how an X-Window dump is
generated. This file is also used by mail readers to
determine how to display a particular object, e.g., how to
display a message that is of type image/gif. A default
/etc/mail/mailcap is provided in the DG/UX system. The user
(with appropriate privilege) may modify this file, or the user
may supply a customized mailcap in a different location (see
mailcap(4)).
· mailto: The mailto tool generates and sends mail in MIME
format. It is a straightforward tool similar to mailx that
can generate MIME objects (by using definitions in mailcap) or
can include pre-defined MIME objects (e.g., a postscript
file).
· metasend: The metasend utility is another way to send MIME
messages. It is a cruder interface than mailto but is useful
when sending pre-existing files. It assumes that the user
will define content types correctly, so it probably has more
value as an underlying support utility than as a user tool.
· splitmail: The splitmail utility is used by mailto to split a
large message into MIME-compliant partial messages. The
default maximum message length is 250K bytes, but this can be
overridden. (The receiver of this large message also receives
it in the partial message form; the showpartial utility,
described below, is used to concatenate the partial messages.)
· extcompose: This simple utility, invoked by mailto, helps a
user enter data so that a mail message can be sent with a
reference to "external" data.
· getfilename: This simple utility is used in mailcap to help
mailto query the user when a filename is needed.
· metamail: The metamail utility is used by mail readers, e.g.,
mailx, when viewing non-text mail. Metamail is generally not
run directly by the user, but is intended to be used by other
mail-reading programs. The primary purpose of metamail is to
allow diverse mail reading programs to centralize their access
to multimedia information. This means that the mail reading
programs only need to know about the types of non-text
messages that may be received, not how to handle them.
· richtext: The richtext utility views "richtext" files.
Richtext is based on a simple markup language and provides
support for such text styles as bold-face, italics, etc. This
utility is used by metamail.
· showexternal: This utility is called by metamail to retrieve
the body of a mail message that is included by external
reference. If showexternal is able to retrieve the message,
it must invoke metamail so that the content-type of the object
can be determined for proper display (the content-type of
external references is not known beforehand).
· shownonascii: This utility views mail messages that are in
non-ASCII format. It is referenced by mailcap and called by
metamail.
· showpicture: This utility is used in mailcap and is called by
metamail to display an image. Showpicture will call an X
viewer (as determined by the site administrator or user);
popular X tools used to display images are xv or xloadimage.
(Note that xv and xloadimage are not part of the DG/UX
system).
· showpartial: This tool is used by metamail to fetch each part
of a large message (that has been split by splitmail) for
future use. As each part is read in, it is stored in the /tmp
directory. When the complete message has been read in, it is
displayed. After the full message is viewed, it is deleted
(the partial messages remain in the user's mailbox, for the
user to save or delete individually) and the partial messages
in /tmp are deleted as well.
· mimeto7bit: This utility can be used by a mail transport
agent (e.g., SMTP) to convert non-7-bit MIME messages into
7-bit MIME messages. 8-bit printable messages are converted
to quoted-printable; binary messages are converted to base64
format. A mail transport agent that is handing a non-7-bit
MIME message to a transport agent that only understands 7-bit
messages can use mimeto7bit to encode the message into a 7-bit
message. This can be used by any MIME mailer to help support
the 8BITMIME coding standard, as specified in RFC1426.
· mimencode: This underlying tool can be used by email or
office automation products to translate byte streams into (or
out of) the mail encoding formats supported by MIME. The
encoding must be done because, currently, binary mail cannot
reliably be sent through the Internet. The encodings done by
mimencode may be preferable to the traditional
uuencode/uudecode.
· mailproc: This underlying tool can be used by the user or by
email and office automation products to manipulate or process
a mailbox. It parses a mail format file into messages,
performs a set of user-defined tests on each message, and
takes appropriate action on the message. It is not used
directly by the other MIME utilities, but it understands MIME
and is able to glean information from mail headers and message
bodies.
· mailR: This is a mail message and mail header rewriting
language that can be used by email systems and office
automation products to convert non-MIME messages into MIME
format. It can also be used to filter mail headers or text,
for whatever reason. The mailR support, and the accompanying
rewrite tool that uses the mailR language (described below),
are probably most useful for mail transport agents. The DG/UX
system uses smtp as the mail transport agent, but a system
administrator who wished to use a different agent can do so
and would find mailR to be a useful mechanism to put messages
and headers into other formats.
· rewrite: This file provides functions, written in the mailR
language, to do mail message rewriting.
MIME Configuration
The mailcap file is the primary way that MIME support on a particular
system can be tailored by a system administrator or the user. This
file contains information useful to senders and readers of MIME mail.
Senders of MIME mail (e.g., mailto) use mailcap to determine how to
create or find MIME objects of a certain content type; readers of
MIME mail (e.g., metamail) use mailcap to determine how to handle or
display MIME objects contained in mail messages.
MIME content types are represented in a type/subtype pair and are
used by mailcap. Suppose that a site running X11 wants to be able to
send or receive images in both gif and jpeg formats; its mailcap file
will contain entries that handle content types image/gif and
image/jpeg. A site that wishes to support handling postscript files
may have an entry for content type application/postscript. New
content types may be created by the administrator/user, simply by
adding an entry to the file; all that is needed is for the entry to
contain the name of the content type, the way that objects of that
content type should be handled by the mail reader, and the way that
objects of that content type should be created (or found, if it is an
pre-existing file).
A sample entry in mailcap for an image/gif content type may be:
image/gif; showpicture %s; compose="xwd -frame | xwdtopnm | ppmtogif
> %s; exit 0"; description="An X11 window image dump in GIF format"
This entry for content type image/gif tells MIME readers to use
showpicture to display the object; and it tells MIME senders to use
xwd to create or compose a MIME object of that type.
User Commands
To send a MIME message, the mailto command provides basic
functionality. Users familiar with mail or mailx for sending mail
will find mailto to be similar. The mailto command relies heavily on
the mailcap MIME configuration file and can be used to send normal
text messages, richtext messages (see below), and messages of special
content types. Mailto makes use of the underlying MIME support
utilities (see MIME Commands and Utilities). See EXAMPLES for a
sample mailto session. Note that mailx currently does not provide a
way for the user to generate and send MIME messages.
The metasend command can also be used to send MIME messages, but it
has a crude interface and is not intended to be the primary mailer of
MIME messages.
To read a MIME message, MIME support has been added to the mailx mail
reader. Basically, mailx invokes the metamail tool, which uses the
mailcap file to determine how to display MIME objects from mail
messages to the user. See EXAMPLES for a sample mailx session.
Here is a basic outline of what happens when a mail reader (such as
mailx) encounters MIME mail:
· mailx begins reading a mail message, scanning the message
headers
· mailx sees a MIME message header and invokes metamail
· metamail scans the mail message, handling each MIME object
sequentially
· metamail identifies the content-type for each MIME object
within the mail message
· For each content-type, metamail reads mailcap to determine how
to properly display the associated MIME object
· metamail invokes the appropriate display utility (e.g.,
showpartial or showpicture or richtext). Note that there are
situations where metamail will be recursively invoked (see
showexternal(1M)).
Encoding / Decoding Schemes
Some binary or 8-bit data cannot be transmitted over some transport
protocols and (for reliability) should be encoded into a "7-bit
short-line format" as specified in RFC821. As mentioned in RFC1521,
there is a tradeoff between efficient encoding of mostly binary data
and the need for a readable encoding of mostly 7-bit data. With this
in mind, the MIME specification in RFC1521 denotes the quoted-
printable and base64 encoding schemes.
quoted-printable This breaks the data into octets that correspond to
printable ASCII characters, as defined by rules in RFC1521. Hard
line breaks are represented with the CRLF sequence; soft line breaks
are inserted if encoded lines would otherwise be longer than 76
characters long. Though quoted-printable format is highly readable,
there is a tradeoff with reliability, especially when passing through
mail gateways that translate into EBCDIC. For such gateways, or when
transporting binary files, the base64 encoding is preferred.
base64 This encoding is simple and reliable, yet (as stated in
RFC1521) the encoded data is only about 33 percent larger than the
unencoded data. This scheme basically transfers 3 bytes (24 bits) of
data into 4 groups of 6-bit data. A 6-bit group of data maps onto a
64-character printable alphabet that is defined by the encoding
scheme. By default, binary files are transferred with the base64
encoding.
8BITMIME This is a coding standard for mail transport agents
indicating that an agent can receive 8-bit and binary MIME messages
and can convert these messages to 7-bit MIME messages when handing
them to other transport agents (if necessary). The underlying MIME
tools support 8BITMIME, but the current SMTP transport agent does not
provide 8BITMIME support.
New Mail Headers and Format
Mime-Version: 1.0 All MIME mail must have this header included in
the mail message to be considered acceptable as a MIME message. In a
multi-part message (e.g., a message that includes text, richtext, and
a binary file), this header needs to appear only once and is not
needed for each body part of the multi-part message.
Content-Type This specifies the type/subtype of each particular MIME
object in the message. Supported content types are defined in
/etc/mail/mailcap; content types may also be defined by the user.
For instance, if a MIME object is an image in gif format, the header
for that part should be:
Content-type: image/gif
If the message is a multi-part message, there will be an additional
header that says:
Content-Type: multipart/mixed
Content-ID This specifies a unique ID for each part of a multi-part
message. The beginning and end of each part is denoted with a
PART.BOUNDARY number.
Content-Transfer-Encoding This header specifies the encoding scheme
that was used for a particular MIME object.
A sample mail file demonstrating how to use these headers is provided
in EXAMPLES below.
EXAMPLES
Sample mailto Session
Note that the choices in this example may or may not match the user's
-- this depends on the /etc/mail/mailcap file at the user's
particular site. In this example, everything shown to the user is
non-bold-faced; the user's responses (and the message text) are
boldfaced. Also note that mailto is somewhat verbose; verbosity can
be controlled with the .mailrc file (see mailto(1)).
$ mailto nathan
Subject: test GIF image
Hey, look at this!
~*
UX:mailto: Please choose which kind of data you wish to insert:
UX:mailto: 0: A raw file, possibly binary, of no particular data
type.
UX:mailto: 1: Raw data from a file, with you specifying the content-
type by hand.
2: An audio fragment
3: An X11 window image dump in GIF format
4: A reference to data stored in an external location
5: A Postscript File
UX:mailto:
Enter your choice as a number from 0 to 5: 1
UX:mailto:
If you want to include non-textual data from a file, enter the file
name.
If not, just press ENTER (RETURN): /tmp/gull.gif
UX:mailto:
Enter the MIME Content-type value for the data from file
/tmp/gull.gif
(type '?' for a list of locally-valid content-types): image/gif
UX:mailto: INFO: Included data in 'image/gif' format
That's it! See you at lunch -- Alex
Sample mailx session
In this example, everything shown to the user (including the message
text) is non-bold-faced. Explanatory comments (for man-page
purposes) are bold-faced. The verbosity of metamail (which is called
by mailx) is controllable; see metamail(1).
$ mailx
mailx version 4.2mp Type ? for help.
"/var/mail/nathan": 1 message 1 new
>N 1 alex@machineA Thu Jul 28 17:16 840/59372 test GIF image
? (user hits 'enter')
Invoking metamail...
Date: Thu, 28 Jul 1994 13:16:18 -0400
From: alex@machineA
To: nathan
Subject: test GIF image
Hey, look at this!
UX:metamail: This message contains 'image/gif'-format data.
Do you want to view it using the 'showpicture' command (yes/no) [yes]
?
(user hits 'enter' for default)
UX:metamail: INFO: ---Executing: showpicture
NOTE: TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE q IN IT.
(at this point, the picture appears; when the user types 'q' on the
picture, the message continues)
UX:metamail: INFO: ---Executing: richtext
That's it! See you at lunch -- Alex
Sample Mail File (with Headers)
For man page purposes, additional comments are provided in bold-face.
From: alex@machineA
To: nathan
Subject: test GIF image
Mime-Version: 1.0
Message-Id: <494_22784_775426580_1@machineA>
Content-Type: multipart/mixed;
boundary="PART.BOUNDARY.494.22784.machineA.775426580.1"
Content-Length: 58833
(The following is a preamble that will be seen only by mail readers
that do not understand MIME format.)
> THIS IS A MESSAGE IN 'MIME' FORMAT. Your mail reader does not
support MIME.
> Some parts of this will be readable as plain text.
> To see the rest, you will need to upgrade your mail reader.
--PART.BOUNDARY.494.22784.machineA.775426580.1
Content-ID: <494_22784_775426580_2@machineA>
Content-type: text/plain
Hey, look at this!
--PART.BOUNDARY.494.22784.machineA.775426580.1
Content-ID: <494_22784_775426580_3@machineA>
Content-type: image/gif
Content-Transfer-Encoding: base64
(image content is deleted in this example for brevity)
--PART.BOUNDARY.494.22784.machineA.775426580.1
Content-ID: <494_22784_775426580_4@machineA>
Content-type: text/plain
That's it! See you at lunch -- Alex
--PART.BOUNDARY.494.22784.machineA.775426580.1--
FILES
/etc/mail/mailcap MIME configuration file
/etc/mail/rewrite file for mail message/header rewriting
SEE ALSO
extcompose(1), mailproc(1), mailto(1), mailx(1), metamail(1),
metasend(1), mimencode(1), splitmail(1), getfilename(1M),
mimeto7bit(1M), richtext(1M), showexternal(1M), shownonascii(1M),
showpartial(1M), showpicture(1M), mailcap(4), rewrite(4), mailR(5)
NOTE
The specification for MIME message bodies is described in RFC1521.
RFC1522 describes MIME message header extensions for non-ASCII text.
Other related RFCs include RFC1426, RFC1427, and RFC1428. Currently,
the full 8BITMIME support as specified in RFC1428 is not provided in
the DG/UX system.
RFCs can be accessed via anonymous ftp to nic.ddn.mil.
Licensed material--property of copyright holder(s)