encoded email attachments

In order for folks to be able to send you binary files through the text-only medium of email, each binary file must be encoded into plain-text (ASCII) form; a form that uses only letters/digits/puctuation. The result -- which may look like gibberish, but is text-only gibberish! -- can then successfully be sent as part of their email messages.

When you read the email, your email program is normally decodes the attachments automatically, and saves them to separate files. For various reasons, however, the process can fail. For example, some attachments get double-encoded -- a Word document might be binhexed, and then MIME-encoded by the emailer -- and your email program only decodes the 2nd layer of encoding, leaving you with something still BinHex encoded. Then you have to decode the attachment manually. Three tools are

munpack

If your email says ``This message is in MIME format'' or ``Encoding: BASE64'', followed by a solid block of text with 60 characters per line, you have a MIME-encoded attachment.

Save the file to a temporary file (say, ``xxx'') in a special temporary subdirectory, and then after quitting the email program, cd to that special subdirectory and run munpack, e.g., munpack xxx. The reason for doing this in a specially-made subdirectory is that you can know exactly which files are decoded/produced.

One or more files are produced by the command. Be sure to delete the xxx file when you have retrieved the attachments. (The sizes of the attachments, in bytes, should total about 75% as much as the size of the original email where they were MIME-encoded. (Base64 encoding yields (log 256)/(log 64)=4/3 the number of original bytes.)

Often munpacking produces a small file named with the .desc suffix, to accompany the actual attachments. It is just text which accompanies the attachments; display it with the command ``more *.desc''.

If the resulting attachment is a file with the suffix .gz or .tar or .Z or .zip, it is in compressed and/or archived form, and must be unpacked using (respectively) gunzip, tar, uncompress, or unzip.