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 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.

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:

On the "Tools" menu, click "Options", then click the
"Mail Format" tab, and then the "Internet Format" button.

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:

On the "Tools" menu, click "Options", and then click the "Mail Format" tab.

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.

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:
https://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

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:

Save (as a file) a tnef attachment you've received;
we'll use it later for testing and to simplify configuration.

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.

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

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):

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

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...".

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.

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!

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:

Save (as a file) a tnef attachment you've received;
we'll use it later for testing and to simplify configuration.

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):

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):

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).

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.