Eric's Webspace
Extracting files from application/ms-tnef attachments
Download Now!

Good News: I found other ms-tnef decoding programs! If mine doesn't do what you want, check out   (Linux)   (Win98)   (Windows)   (Windows)   (Mac)

I use Microsoft Outlook at work and, well, anything that isn't made by Microsoft at home. If I try to send a file to my home, it comes through as an "application/ms-tnef" attachment with no file name. Or maybe it's named "winmail.dat". Or "unknown.001". It depends on the mail program I use.

Spending a bit of time looking, I found out that Microsoft came up with their own encapsulation format so they could handle special Outlook things like sending appointments back and forth. Unfortunately, they made it so hard to turn off this pain-in-the-butt format that not one in a hundred Outlook users can do it. So I have to put up with getting useless attachments.

To cut down my frustration rate, I wrote a quick and dirty program to help me extract files from the ms-tnef attachment. If I was any good, I'd have studied all about the ms-tnef format. But I'm not. I noticed that the desired files are byte-for-byte intact inside the ms-tnef stuff. So all I do is look for the file header for the file I want. Sure, some files don't have standard headers, but the stuff I want does. When I find a known file header, I extract everything starting at that point. Again, none of the files I use care if there is extra stuff on their ends. So it works for me.

Microsoft's ms-tnef format is ONLY for Microsoft Outlook. Not Outlook Express. Not Netscape. Not Eudora. NOTHING else can read it. It is automatically used when Outlook uses the "Rich Text" format for sending email (which is the default method). Microsoft is betting that Outlook users are too stupid to change their default settings and this will force everyone else to go buy Outlook just so they can get attachments from all the stupid Outlook users.

But don't panic just because you get an ms-tnef attachment! Unless the user tells you there are attachments, there may not be attachments! When Outlook sends a message in Rich Text format, it ALWAYS includes an ms-tnef attachment which contains useless information like font types, background images, and the like. In other words, no real data is in the attachment. On the other hand, if there is an actual attachment(s), it gets buried in the same ms-tnef attachment with all the useless stuff. That makes it a bit difficult to get at. Which is why I wrote my program.

One way to solve the ms-tnef problem (without my program) is to tell the Outlook user that is sending you mail to quit sending in "Rich Text Format". During the message composition period, they can select "Rich Text" or "Plain Text" from the menu. Ask them to use plain text! On the other hand, BEFORE they start composing, the Outlook properties allows you to change the default composing format from "Rich Text" to "HTML". I recommend HTML very highly! It makes it much easier to insert pictures and is also an actual standard (which Rich Text is NOT).

Another thing even easier is to tell them to open their address book and look at the properties for your name. There they can select how YOU will get messages, attachments, and the like. Ask them NOT to use Rich Text for you.

If that fails, try telling them to "zip" all the attachments before they send them. There is a good chance that whatever zip software you use can find the zip file even when it is buried in all the ms-tnef junk.

Finally, if the person sending you mail is too stupid or there are just too many of them, you'll need to use my program.

Click the "Download Now!" icon at the top of this page to get the program and all source code. The program is written in Visual Basic 5. More than likely you already have the VB5 runtime files that are needed (just try running the program to see if it works!), but if you don't, you can get them here:
Microsoft VB5 Runtime files
Generic VB5 Runtime files

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Ask Jeeves