I’ve created six files with bogus extensions. The filename prefix denotes the
actual content (text/plain, image/png and application/octet-stream), and
I simply tacked on an extension for decoration. What happens when I send
off a message with all six files attached? Let me look at three e-mail
clients I use regularly. Lotus Notes 7.0.2 on Mac OS X displays the problem
right after attaching the files. Note how the icons match the file extensions
and not their content (remember: the file’s content are the first three
letters of the name, the rest is decorum): Not a single one is right.
In Thunderbird version 2.0.0.6 we have a very similar situation after
attaching the files:
All wrong again. Mutt interprets the files with
these content-types and gets none right. The reason is explained in the
manual: Mutt consults the mime.types file to determine the type from
the extension.
A 2 exe.jpg [image/jpeg, base64, 56K]
A 3 exe.txt [text/plain, quoted, unknown-8bit, 56K]
A 4 png.jpg [image/jpeg, base64, 133K]
A 5 png.txt [text/plain, quoted, unknown-8bit, 133K]
A 6 txt.exe [applica/x-msdos-pr, quoted, 0.1K]
A 7 txt.jpg [image/jpeg, quoted, 0.1K]
Is it trivial to determine a file’s content? Let me use the Unix file command and see.
$ file ???.???
exe.jpg: MS-DOS executable (EXE), OS/2 or MS Windows
exe.txt: MS-DOS executable (EXE), OS/2 or MS Windows
png.jpg: PNG image data, 500 x 778, 8-bit/color RGB, non-interlaced
png.txt: PNG image data, 500 x 778, 8-bit/color RGB, non-interlaced
txt.exe: ASCII text
txt.jpg: ASCII text
Yes, it is trivial.