Faculty Liaisons' Athena Mail/MIME FAQ

# Athena Mail/MIME FAQ

> What is MIME?
> What Athena mail programs (a.k.a. Mail User Agents or MUAs) support MIME attachments?
> How does MIME support work on Athena?
> Can I customize or disable the MIME display behavior?
> How do I send a MIME attachment?
> I set up my account previously to use the mime locker, should I change anything?

## What is MIME?

MIME stands for Multipurpose Internet Mail Extensions. MIME is an encoding method designed for exchanging binary files over the internet (particularly via email messages) in a standardized, platform-independent form using a coding scheme called base64. A MIME-encoded message can contain several parts, each of which can be a different type of file: ASCII text, pictures, video, sound, or any other type of binary data.
Top

## What mail programs (a.k.a. Mail User Agents or MUAs) on Athena support MIME attachments?

- nmh - the standard mail system on Athena (inc, show, etc.)
- exmh - a graphical interface to mh
- Netscape mail

For general information about Athena supported mail handlers see: Electronic Mail on Athena (AC-31)
Top

## How does MIME support work on the standard Athena mail system?

Beginning with the summer 1999 release of Athena 8.3, the standard Athena mail system (inc, show, etc.) is configured to handle MIME attachments automatically. (The MH suite has been upgraded to nmh or "new MH" which continues to use the same basic commands such as inc, show, etc.; major differences in behavior are explained in the Athena 8.3 Release Notes.)

When you show a message with a MIME attachment, you will usually see something like this:

      Hi Fred, here's the latest revision to Chapter 6.

      part 2     application/octet-stream  149K
      Press return to view PDF document, Type Control-C to cancel

If you press the `Return` key, the attachment will be opened in an appropriate viewing application (in this case, the Adobe Acrobat reader). If you type `Control-C`, the attachment will be skipped, and the rest of the message will be shown.

Note: Earlier Athena releases included MIME support for MH, but some user configuration was required to open attachments automatically. If you previously set up your account to use the scripts in the mime locker, you should now revert those changes to make sure you're getting all of the current defaults.

### Default MIME handling

The show command is now configured to handle MIME attachments as follows:

- If a message contains an Microsoft Word file, it will be shown as plain text. (If you would prefer to view them in Frame or in a Web browser, see the section on customizations.)
- In general, if a message contains an attachment with a recognized file format, you will get a prompt indicating the type of file and asking whether you wish to view it. If you agree, the attachment will be opened in an appropriate application (e.g., Acrobat Reader for PDF, xv for images).
- If a message contains an attachment which is not recognized or for which an appropriate "viewer" application is not configured, you will get see a message to that effect, possibly indicating the file type. You may use the mhstore command to extract the attachment.

### Dealing with attachments manually

If the file type of the attachment is not recognized or nmh is not configured to display it automatically, you can save the file as explained below and try to find an application with which to view it (either on Athena or on a Mac or PC). Before putting too much effort into this, it's a good idea to ask the sender what type of file it is (including the version number of the application used to create it), and whether the sender can make it available in another format if you don't have access to an application that can open the original.

#### Step 1: Extract the attachment

When you try to show the file, you will see something like this:

      Here it is...make sure the speakers are ON but
      the volume is very, very low

      part 2     application/zip           557K

      Unknown content type application/zip
      Use mhstore to store this data to disk.

If you just type `mhstore`, it will save each part of the current message, with a filename of the form message#.part#.ext (by default, to the current directory). The message text is usually the first part, and each attachment is an additional part. For example:

      athena% mhstore
      storing message 3 part 1 as file 3.1.txt
      storing message 3 part 2 as file 3.2.zip

To save only the attachment, you must specify its part number:

      athena% mhstore -part 2
      storing message 3 part 2 as file 3.2.zip

If you don't have the part number handy from the earlier show command, you can see a list of all the parts by using the mhlist command:

      athena% mhlist
       msg part  type/subtype              size description
         3       multipart/mixed           753K
           1     text/plain                 141
           2     application/zip           557K

Notes on using `mhstore`:

- Like most MH commands, `mhstore` and `mhlist` default to the current message; to specify a different one, simply add the message number before any other options. For example, to specify message 4 rather than the current message:

        athena% mhlist 4

        athena% mhstore 4 -part 3

- If a file of the same name already exists, `mhstore` will save over it without warning.
- To give the saved attachment its original filename rather than a name based on the message and part nos., try the `-auto` option. For example:

        athena% mhstore -part 2 -auto
        storing message part 2 as file HoHoHo.zip

  (How well this works depends on how the header was constructed by the sender's mail program, and on whether the filename starts with any unusual characters.)
- `mhstore` saves to your current working directory unless you have a directory for "nmh-storage" defined in your `~/.mh_profile`. For example, if you always want to save parts to the /tmp directory you would use the line:

        nmh-storage: /tmp

  Note that this may not work for parts saved with the `-auto` switch.

#### Step 2: Identify the file type

If the file type isn't clear, you can use the file command to try and identify it:

         athena% file filename

or the SIPB version, which may recognize other file formats:

        athena% dd sipb
        athena% /mit/sipb/bin/file filename

If this doesn't tell you anything useful, look carefully at the show prompt again for hints. For example:

         athena% show
         part 1     application/octet-stream   13K

         Unknown content type application/excel
         Use mhstore to store this data to disk.

(although the part description "application/octet-stream" doesn't help, from the next line it appears that the filetype is Excel).

Finally, you can run mhstore -auto to try and save the attachment with its original filename to see if the name or extension tells you anything:

         athena% mhstore -auto
         storing message 14 part 1 as file nonsense.xls

#### Step 3: Find an application for viewing the file

Once you've determined the file type, you can try and find an application on Athena able to open it. Some common cases:

MSOffice files:

- Word files can be generally be opened in FrameMaker on Athena, although FrameMaker will not always have filters capable of opening the newest Word versions. Alternately, you can ask the sender to use Word's "Save As" feature to save the file as tex-only (or in the format of an older Word version which Frame supports), or try to find a Mac or PC in your department with the same version of Word, another word processor that can read it, or a file translation program.
- Excel files can generally be opened in Xess on Athena (try File-->Open, and select "XLS" under File Format), although it may not be able to handle newer Excel versions. Alternately, you can ask the sender to use Word's "Save As" feature to save the file as tab-delimited text (or in the format of an older Excel version which Xess supports), or try to find a Mac or PC in your department with the same version of Excel, another spreadsheet program that can read it, or a file translation program.
- At this writing, PowerPoint slides cannot be read directly on Athena. Your options are either to find a Mac or PC with PowerPoint installed, or to ask the sender to convert the slides to HTML, images, PDF, or some other format for you.

uuencoded files:

If a message appears to contain a uuencoded file, you can decode it as follows:

         athena% show | uudecode

(The file will be decoded to its original name in the current directory.)

BinHex files:

If the attachment is a BinHex file (an encoding type often used on Mac files), you can decode it as follows:

         athena% add consult
         athena% xbin filename

This will silently unravel the BinHex file and leave three additional files. The file with the extension .data is the file with the MIME content, the others can be discarded.

         athena% /mit/sipb/bin/file testfile.*

will return the following:

         testfile.data: Microsoft Word 6.0 Document
         testfile.doc:  BinHex binary text, version 4.0
         testfile.info: data
         testfile.rsrc: data

exmh

exmh is graphical interface to MH which is configured to handle MIME messages. (Note: this program is maintained by the SIPB, not IS. It is based on MH, and there are no general problems going back and forth between the two. There is a known problem handling mail from exmh when an account goes over quota.)

To run exmh from an Athena workstation:

         athena% add sipb
         athena% exmh &

The non-text parts of a MIME message are labelled separately; pressing the right mouse button over each label brings up a menu of options for saving or otherwise handling that part.

Documentation on exmh

athena% man exmh
online help within exmh
Manual and extensive FAQ.

Top

## Netscape mail

Netscape mail is designed to handle MIME mail in much the same way it handles HTML files: selecting a component will either bring up an appropriate helper application or present you with the option of saving the file. However, Netscape stores mail in a format that is incompatible with MH-based inbox; once read in Netscape, a mail message will not be visible from the other readers.

For information on configuring your Athena account to use Netscape mail, see Athena Consulting's stock answer on how to use Netscape Mail.

Top

## Can I customize or disable the MIME display behavior?

There are several customizations you can make with environment variables:

variable | customization
--- | ---
MU_HTML html | display HTML mail in a web browser
MU_MSWORD frame | display Word documents in FrameMaker (rather than as text)
MU_MSWORD html | display Word Documents as HTML in a web browser (it will fall back to Frame in the case of Word 6 or Word 7 files, which can't currently display as html)
MU_AUDIO no | prevent any playing of audio attachments
NOMHNPROC | disable automatic display of MIME attachments (if you set this, you can still manually invoke MIME display by using mhshow instead of show)

To make one of these changes the behavior, use the setenv command with the corresponding variable above. For example:

         athena% setenv MU_MSWORD frame

would cause Word docs to be opened in FrameMaker, while

         athena% setenv NOMHNPROC

will disable automatic MIME display.

If you want to make a customization permanent, add the setenv line to your `~/.environment` file and it will take effect at your next login. (For general information about environment variables and customizing your Athena account, see the IS Publication Working with Configuration Files ("Dotfiles") .)

Top

## How do I Send Mail with MIME Attachments?

Exmh handles attachment sending automatically, but if you don't want to switch from MH you can still send MIME attachments manually.

First, use a text editor to write a message to accompany the encoded file. Then at the Athena prompt do:

         athena% add graphics
         athena% mpack -m 0 -d messagefile file-to-encode recipient-address

(Setting the "-m" option to zero means that there is no limit to size of the generated message). You will be prompted only for the Subject before the mail is sent. For example:

         athena% mpack -m 0 -d /tmp/msg /tmp/HoHoHo.zip ajfox
         Subject: Claus test

Note: the -m flag can be used to split the file into several separate messages of a specified maximum size. See the man page for more details.

Top

## I set up my account previously to use the mime locker, should I change anything?

If you previously set up your account to use the scripts in the mime locker, you should now remove those lines from your `~/.environment` files:

         add mime
         source /mit/mime/share/setup.csh

or if you are a bash user, remove from your `~/.profile`:

         add mime
         . /mit/mime/share/setup.sh

Top

Academic Computing Home Page

Last modified: Tue Jul 27 09:18:32 1999
Comments to f_l@mit.edu