Macintosh Files, Servers and Email

Summary: Macintosh files sent through email as attachments or downloaded from servers. How to identify those files? How to decode them?

Internet and Macintosh Files

It seems useful to publish some comments on how to manage Macintosh files sent through the Internet: files downloaded from servers (through the FTP or HTTP protocol) or files received through email (as attached files). Two main reasons justify a special treatment. First of all, Macintosh files are not monolithic, but may be composed of two pieces, called forks ,i.e. a data fork and a resource fork. Please visit our page on file forks for more details.
Secondly, the nature of a Macintosh file is not expressed as a file extension (or file suffix), but as a signature, a string of characters coding the file creator and the file type. Again, visit our page on file signatures if you want more details.
Last but not the least, the email protocol doesn't allow to send binary files, but only text files. This means that the bytes of the file are only coded on 7 bits and not on 8 bits.
This explains why most FTP and mail programs running on the Macintosh silently build containers when asked to upload a file to a server or to send a file as an attachment.

Macintosh Files Attached to E-mail Messages

Most Macintosh mail programs execute silently two different operations on attached files:

On the contrary, a PC mail program only does the encoding of the attached files.
When the attached files arrive on the target computer, the mail client has to decode the file, then to open or break the container to replace all pieces where they belong.

De Facto Standards

Four standards are used in this context: MacBinary, AppleSingle, AppleDouble and BinHex. MacBinary and AppleSingle describe a way to put in a single file (called the container) the two forks composing the file, plus some elements like the signature. The resulting file is then encoded in the usual way.
The AppleDouble standard doesn't put both forks in a single container, but in two separate streams that the MIME mail program can put in a single message. At the other end, the client will decode what it knows (generally only the data fork, just dropping silently the resource fork). Please note that the AppleDouble and AppleSingle formats are a MIME standard (RFC1740).
The Binhex standard holds a special position because it does both operations together, plus some simple data compression (RLE).

What to Do?

The first thing to do is to ascertain how the attached file was created and handled by the sender.
You can use to that end our MacMail program, whose goal is to try to automate as much as possible the operations to do. Please consult its page to know more about it.
Another proven method is to try to open the file in a text editor and to look for some specific strings.
Binhexed files contain following string in the first line: "(This file must be converted with BinHex 4.0)". Visit our page on the BinHex format for an utility to convert the binhexed files.
MacBinary files are not quite so easy to recognize, because there is no "magic" signature. Anyway, you should find at the beginning (offset 2) the string of the original Macintosh filename. A little further (offset 65) is the signature of the file. Visit our page on the MacBinary format for an utility to convert such files.
AppleDouble and AppleSingle files should never exist under this form on the target machine. Since AppleDouble and AppleSingle are registered Mime types, all recent mail clients should decode them without asking the user. However, we frequently hear of users trying to guess what can be in those '*.dat' files (AppleSingle and AppleDouble often use the dat extension).
See our page on those formats for more information. See also our Mac2SFM utility to manage those containers on a NTFS/SFM server.
MacMail can unpack the AppleSingle container if you need to. Most of the time, the only file of interest in attachments sent according to the AppleDouble standard is the data file. How to guess? MacMail can help you, since it will recognize the header file and display some information about it. MacMail can also recognize the data file, or not, depending on the nature of the data.

Special Situation of Fonts

When fonts are transferred from the Macintosh to the PC as attached files, several situations can occur. If the font was transferred in AppleDouble or AppleSingle format, your mail client may know those formats and try to decode the file. Since it thinks that the only usable part must reside in the data fork, you'll get an empty file, that is the empty data fork. The software generally discards the resource fork without explanation. It may think this is the only logical way to go.
Even if you dare to disagree.

Fonts in MacBinary or BinHexed Formats

You may have more chance if the font was sent as a BinHex file or a MacBinary file. In the first case, use our DeBinHex utility (available from our page on the BinHex format) and convert it to the MacBinary format.
Then, copy this MacBinary file (in MacBinary copy mode) with MacDisk onto a physical floppy or Zip cartridge or with MacImage onto a virtual Macintosh disk. Then, copy it back to the PC hard disk. The program will ask you whether to convert the font. Just answer yes.
We recommend you visit our page on Fonts Transfers for more information on this subject.

How to Send an Attached File to a Macintosh User?

Some users asked us how to send by mail a file created on the PC to a Macintosh user. Some preliminary remarks are useful and must be done.
First of all, if you want to send a Word or Excel file, don't send a file coded in the format of the latest version. As a rule of thumb, only send Word files as Word 5 for the Macintosh or Word 2 for Windows, and Excel files as Excel 5. For other text formats, use RTF.
If you send such a file as an attachment, odds ar good that the file will display on the Macintosh screen with a generic (cornered sheet) icon, and that the user, when double-clicking this icon, will get an error message about opening this file as Simple Text. The user must first launch the application, then open the File menu and select the Open item.

Sending a MacBinary File

It is possible to avoid this, taking in account the fact that most mail agents, on the Macintosh, automatically decode the attached files received as MacBinary files. This way, the recipient won't have anything to do (and can't do any harm). See our page on the MacBinary format for more information on this coding. With our little MacBinary utility, you're able to create on the PC a MacBinary file with your Word document, to send is as attachment to a Macintosh user, which will get a normal file, with a correct icon, double-clickable as it should be. This utility is downloadable from the MacBinary page.

Pierre Duhem (ex-Logiciels & Services Duhem)
3, rue Pierre Haret - F-75009 Paris (France) - Tel. (+33) [0]149 700 455