Microsoft Outlook/Exchange MS-TNEF handling (aka "Winmail.dat", "Win.dat", or "Part 1.2" problem of unopenable email attachments)

David A. Wheeler

June 12, 2006 (revised June 21, 2013)

All too often nowadays people report that they "can't open the attachment" of an email, because they only received a file named (typically) "Winmail.dat", "Win.dat", or "Part 1.2". Here's a brief explanation of the problem, and what to do about it.

The Problem: Microsoft Outlook sometimes sends a non-standard format (TNEF)

The basic problem is that in certain cases Microsoft's Outlook or Exchange programs use a nonstandard extra packaging mechanism called "ms-tnef" or "tnef" when it sends email - typically when it sends attachments. What Outlook is supposed to do is simply use the industry standards (such as MIME and HTML) directly for attachments, but Outlook fails to do so and adds this other nonsense instead. The full name of the format is "Transport Neutral Encapsulation Format", but that is a misleading name, because it obstructs reception due to its non-neutral, non-standard nature.

Most other email readers cannot read this nonstandard format. Email clients that can't (currently) read this format include Lotus Notes, Thunderbird / Netscape Mail, and Eudora. In fact, even Microsoft's own Outlook Express can't read this format!

If your e-mail program receives a TNEF file and doesn't understand it, instead of seeing the e-mail and/or attachment, you may only see an attachment named "Winmail.dat", "win.dat", "Part 1.2", or something else ending in ".dat" or ".eml". You can get software to read this file format, if you need to; the details are below.

Senders: How to fix Outlook/Exchange

The problem seems to be two-part: Microsoft Outlook (their "client" program, used on the desktop) and Microsoft Exchange (their "mail server" program, used by a group of people to send and receive email with the rest of the world).

If you use Microsoft Outlook, and want to send attachments outside your office, you have to reconfigure Outlook so that other people can read the files you send :-(. Ideally, convince your IT department to fix your whole organization.

According to MozillaZine, Outlook 2002/XP and Outlook 2003 should be configured this way so that email sent outside is not corrupted:

  1. On the "Tools" menu, click "Options", then click the "Mail Format" tab, and then the "Internet Format" button.
  2. Set "When sending Outlook Rich Text messages to Internet ..." to either "Convert to HTML format" or "Convert to Plain Text format".

If you prefer, in all versions of Outlook, you can disable TNEF completely:

  1. On the "Tools" menu, click "Options", and then click the "Mail Format" tab.
  2. In the "Send in this message format" list, click "Plain Text" or "HTML", and then click "OK".

One oddity: don't send a calendar entry / meeting invitation and an attachment in the same message; some versions of Outlook will send TNEF in this case, even if you've told it not to.

Alternatively, one of the best ways to improve the security of Windows clients is to stop using Microsoft Outlook and Internet Explorer. These two programs are the top two ways that Windows systems get exploited. Replacing them with more secure applications is more important than installing a virus checker - yes, Windows systems also need virus checkers, but cover your oozing wounds before worrying about innoculations. A simple and free way to do that is to get Mozilla Firefox and Thunderbird, but just about any alternative will do.

Microsoft Exchange can be configured to stop sending nonstandard formats.

Receivers: How to read TNEF anyway

So, you just received a nonstandard format - now what? Well, you could tell the sender to configure their email client to send files in standard formats. That's a very friendly gesture; they almost certainly have no idea that their program is sending data others can't read, so you'll do a lot of people a favor. Feel free to give them a link to this page, if it would help: http://www.dwheeler.com/essays/microsoft-outlook-tnef.html

But sometimes that's impractical. In that case, there are tools for reading TNEF files in other readers. Here are a few that seem to work; I'm sure there are many others.

First, I should note that for many systems and email clients, this is a non-issue. For example, the Linux distribution "Fedora Core 5" normally invokes a TNEF reader when trying read such files (e.g., from Thunderbird). (If you need the details, it can use the "ktnef" program, which is part of the kdepim package.)

Macintosh

For Mac, "TNEF's Enough" is one such tool for reading. I've heard from people who are happy with it. It's freeware. Get it from here: http://www.joshjacob.com/macdev/tnef/index.html

Another one is tnefDD for Mac OS X (open source). Elliot Wilen reports to me that he's "observed truncation of filenames with TNEF's Enough, [but] tnefDD did not have this drawback".

Windows

A freely-available tool for reading TNEF format on Windows and Linux is the tool called tnef. It is released under the GNU General Public License (GPL). There are other alternatives, which I'll discuss below, but let's discuss tnef first - it's free and seems to do the job well.

Installation of tnef on Windows is not as trivial as I'd like, in part because on Windows it requires installing the "Cygwin" tool first. Still, I found it works well once installed, and Cygwin is useful for lots of other things too.

Here are instructions for how to install the GPL'ed "tnef" on Windows:

  1. Save (as a file) a tnef attachment you've received; we'll use it later for testing and to simplify configuration.
  2. Download and install Cygwin if it's not already installed. You can get it from http://www.cygwin.com/. The installation has defaults for various settings, which you can change if you want; the main settings are the "root directory" (where the emulated Unix files are stored), a "home" directory (where the user files are stored), and a "local package directory" (where Cygwin packages - files that can be installed - are cached). Any new directory on your main hard drive (which is usually C:) will be fine; I suggest that you do not use your Desktop for any of these directories - if you do, you'll have a busy desktop and Windows will become sluggish.
  3. Download the compressed "tnef" program from http://sourceforge.net/projects/tnef.
  4. Move the compressed program file to your cygwin "home" directory (the one you selected earlier). If you've forgotten what the name of the Cygwin home directory is, double-click on the "Cygwin" icon (to bring up the command line) and type in this command (press Enter after you've typed it in):
       cygpath -w $HOME
    
  5. Double-click on the "Cygwin" icon, which brings up a command line. Type this (pressing return at the end of each line, and replacing 1.4.1 with whatever the current version number is):
      tar xvzf tnef-1.4.1.tar.gz
      cd tnef-1.4.1
      ./configure
      make
      make install
    

Now the tnef tool is installed, but you need to configure Windows to auto-run the tnef tool on these files:

  1. Right-click on a tnef file (a file ending in .2, .dat, .eml, or .tnef as the filetype); in the "Opens With:" section of the dialogue, select "Change...".
  2. Select the executable file using the GUI. First go to the cygwin root directory (that you selected earlier), and then select "usr", then "local", then "bin", then "tnef.exe" (because tnef installs as "usr\local\bin\tnef.exe" inside the cygwin root).

From now on, you can save an tnef attachment somewhere with that file extension, double-click on it, and the original file will then be saved in the same directory. If you get a new file extension, you can configure Windows again for that extension.

Here are alternatives I know of:

  1. winmail opener for Windows My thanks to Elliot Wilen for pointing this one out.
  2. The web is full of references to Fentun's tnef handling tool, a no-cost proprietary program. When I checked it, it was listed only as a Windows 95 tool, with hints suggesting that it does not work on Windows XP. For many, this is a non-starter, so I didn't consider it further. However, John Goggan reports that he has had Fentun running on several different machines for over a year without problems, including on Windows XP with Service Pack 2. He also says that Fentun is easier to install, that he's happy with it, and that he thinks Fentun is a better solution than the tnef program. He also had the following tip:
    Note that fentun doesn't appear to DO anything if you just double-click the executable. You have to pass in a winmail.dat file to have it do something. There is no install -- you just download fentun.exe from fentun.com, put it anywhere on your PC and then have your mail client (Thunderbird, for me) open up a winmail.dat attachment. The first time you do it, just browse to fentun.exe as the application to open it for you and tell the mail client to remember that option. From then on, just open the winmail.dat file up and Fentun will happily run and allow you to easily extract any of the contents!
  3. Another alternative is Winmail - this is new, at the time of this writing only a beta (not a final product), and doesn't seem to be open source software (which is a minus). But it does appear easier to install. See their instructions for more if you're interested.

Linux/Unix

Again, a freely-available tool for reading TNEF format on Windows and Linux/Unix is the tool called tnef. It is released under the GNU General Public License (GPL).

This is easier to install on Linux than Windows, and seems to work well. Here are instructions for how to install the GPL'ed "tnef" on Linux-based systems:

  1. Save (as a file) a tnef attachment you've received; we'll use it later for testing and to simplify configuration.
  2. Download the compressed "tnef" program from http://sourceforge.net/projects/tnef.
  3. Open up a terminal and type this: (pressing return at the end of each line, changing SAVEDIR to whatever directory you saved the compressed file in, and replacing 1.4.1 with whatever the current version number is; after "su" you'll need to type the root password):
      cd SAVEDIR
      tar xvzf tnef-1.4.1.tar.gz
      cd tnef-1.4.1
      ./configure
      make
      su
      make install
    

Now the tnef tool is installed, but you need to configure your GUI to auto-run the tnef tool on these files. Here are the steps for GNOME (KDE is similar):

  1. Right-click on a tnef file (a file ending in .2, .dat, .eml, or .tnef as the filetype); click on "properties". Now select what program to open this type of file (different versions of GNOME and KDE do this differently, but it's very apparant).
  2. Select the executable file using the GUI. First go to the root directory, then select "usr", then "local", then "bin", then "tnef" (because tnef installs as "/usr/local/bin/tnef"). Neil Robertson recommends that the executable line look like this (this will place the expanded file on your desktop):
      /usr/local/bin/tnef -f $1 -C $HOME/Desktop
    

From now on, you can save an tnef attachment somewhere with that file extension, double-click on it, and the original file will then be saved in the same directory (or the desktop, if you've configured it that way). If you get a new file extension, you can configure your system again for that extension.

The future: Thunderbird support

Thunderbird bug/feature request #77811 specifically discusses adding the capability to read Microsoft TNEF format, inline. At the time of this writing, no one has been inspired enough to add direct support for TNEF in Thunderbird.

If this is a problem for you, I encourage you to go to Thunderbird bug/feature request #77811 and vote for its implementation, since this would help Mozilla gauge the importance of this capability.

You can install the LookOut extension. (You may not be able to just click on "install it"; if so, right-click on "install it", save it in a file, and from Thunderbird use Tools/Extensions/Install to install the file.) As described in the LookOut home page, LookOut is a plugin which will allow Thunderbird to interface with Microsoft's mail tools by decoding metadata and attachments encapsulated/embedded in a TNEF encoded attachment. The TNEF decoding engine was inspired (with permission) by the tnef.sf.net project. Some reports seem to suggest that this extension is a little buggy, though, so using tnef or ktnef above might be the better approach at this particular moment. But once it matures, LookOut might be the easier way to handle these extensions in the future.

Other tools

Dmitry Yu Okunev (dyokunev *at* ut dot mephi dot ru) notified me about a utility he wrote for his own purposes. To get it, use the "git" development utility and run:

  git clone git://git.mephi.ru/xtnef.git

I have not tried it, so I don't know how well it works. He reports that it supports tnef and ytnef.

For more information

The Wikipedia article on Transport Neutral Encapsulation Format (TNEF) and the MozillaZine article on Winmail.dat have more information.


I think the above is correct, but I'm only human and there certainly could be mistakes in the above. If you find a mistake, please contact me and tell me how to correct it.

Feel free to see my home page at http://www.dwheeler.com.