Skip to the tool workspace
Browser 123

Handleidingen Email

How to open a winmail.dat file

What winmail.dat is, the one command that unpacks the attachments inside it, and the Outlook setting that stops it arriving in the first place.

A winmail.dat arrives when someone sends you mail from Outlook in Rich Text format and your mail program doesn't speak Outlook's wrapper for it, called TNEF. The message text comes through; the attachments are packed inside the winmail.dat. Unpack it, or ask the sender to send it again as HTML.

The Email Viewer with an Outlook message open, the file bar reading winmail.eml, EML and its size, the subject Agenda and budget for Thursday from Anna de Vries, the plain text body saying the agenda and the budget are attached, and a single attachment chip winmail.dat, DAT, 441 B, where the two files should be

Two attachments were sent. One winmail.dat arrived.

The direct waytnefLinux · macOS · Windows (WSL)

Save the winmail.dat from the mail, then on Debian or Ubuntu:

sudo apt install tnef
mkdir attachments
tnef -C attachments winmail.dat

It prints nothing and writes the attachments into attachments/. To see what is inside without unpacking, run tnef -t winmail.dat. On a Mac, brew install tnef installs the same program.

What is in it

Microsoft documents it in How message format affects email messages. A Rich Text message from Outlook carries a plain text version of the body and one binary attachment, application/ms-tnef, which may hold:

  • the formatted version of the text (fonts and colours)
  • the ordinary file attachments
  • embedded objects, such as pictures pasted into the text
  • Outlook features: meeting requests, voting buttons, custom forms

Outlook and Exchange unpack it without you ever seeing it. A mail system that isn't built on Exchange may not, so you get the text and a file it can't open. Some programs don't recognise the name either and call it something like ATT00001.DAT. It is the same thing.

Get the attachments out with tnef

tnef is a small, long-lived open source unpacker (GPL). We ran version 1.4.18, the one in Debian 13, on a test file with two attachments:

$ tnef -t winmail.dat
agenda.txt	|	agenda.txt
budget.csv	|	budget.csv
$ mkdir attachments
$ tnef -C attachments winmail.dat
$ ls attachments
agenda.txt  budget.csv

The files came out byte for byte. On a real winmail.dat written by Outlook (from the test data of the ytnef project) it unpacked a JPEG photo and an HTML file, both of which open normally.

  1. In your mail program, download the winmail.dat (or ATT00001.DAT) like any attachment.
  2. Run tnef -t winmail.dat to list what is inside.
  3. Run tnef -C attachments winmail.dat to unpack it into a folder. Without -C, the files land in the current folder.
  4. Open the files from that folder.

A few things worth knowing:

  • The name doesn't matter. Renamed to ATT00001.dat, the same file listed and unpacked the same way.
  • It won't overwrite. Run it twice into the same folder and it says Could not create file: File exists for each file and leaves the first copies alone. Add --overwrite if that is what you want.
  • A file that isn't TNEF stops it with Seems not to be a TNEF file.
  • The formatted body is in there too. tnef --save-body winmail.dat wrote a message.html from one test file and a message.rtf from another, depending on which form the sender's Outlook stored.
On Windows

Inside WSL (the Ubuntu that Windows can run), the apt commands above are the same ones. We ran them on Debian, not on a Windows machine.

ytnef, the other one

Debian also packages ytnef (in ytnef-tools). On the same two files, ytnef -f attachments winmail.dat unpacked the same attachments. tnef is the one we would reach for: it is in Homebrew as well, and its body option did what it says on our test files, where ytnef's wrote a file with no name.

tnef 1.4.18 ytnef 2.1.2
Debian / Ubuntu package tnef ytnef-tools
Homebrew Yes No
Unpack into a folder tnef -C dir winmail.dat ytnef -f dir winmail.dat
Both test files unpacked Yes Yes
Save the formatted body --save-body: message.html or message.rtf -F wrote an RTF named only .rtf, a hidden file

What the email viewer shows

If you saved the whole message as an .eml or .msg, the Email Viewer opens it and lists the winmail.dat as an attachment, with its size. Click it to download it, then unpack it with tnef.

Drop the winmail.dat itself on the viewer and it refuses it, by name, instead of showing garbage:

The Email Viewer drop card with a red alert reading This is a winmail.dat (TNEF) file, Outlook's wrapper for formatting and attachments. It isn't a message on its own.

The viewer recognises the file. It does not unpack it.

For an Outlook .msg file, which the viewer does open, see How to open a .msg file without Outlook. It is a different file: a whole saved message, not the wrapper around one.

Ask the sender to fix it

If you can't run a command, or the mails keep coming, the fix is on the sender's side. Microsoft's own advice is that ordinary file attachments don't need TNEF, and that mail with attachments for people outside Outlook should go as HTML or plain text.

In classic Outlook for Windows, per Microsoft's article:

  • For all mail: File › Options › Mail, then under Compose messages in this format, pick HTML or Plain Text.
  • For one message: in the message window, Format Text › HTML or Plain Text.

The new Outlook for Windows offers only HTML and plain text, according to Microsoft's message format page. If a sender on new Outlook or Outlook on the web still sends you winmail.dat, the cause is more likely their organisation's server.

When it comes from the server

Microsoft says mail from Exchange Online (Microsoft 365) uses TNEF by default, and that an admin can turn it off for outside domains with Set-RemoteDomain -TNEFEnabled $false: see How to specify the email message format used for external recipients. That is a request for the sender's IT department, not something they can change in Outlook. We have not run it.

Even with HTML set, Outlook still uses TNEF when a feature needs it: meeting requests, voting buttons, task requests. So the odd winmail.dat can still turn up on one of those, and tnef unpacks it the same way.

Which to use

  • You have a terminal: tnef -C attachments winmail.dat, and the files are in the folder.
  • You don't, or you're on a phone: reply and ask for the files again as HTML or plain text. That is the only route that needs nothing from you.
  • You're not sure what you have: drop it on the Email Viewer. It says whether it is a message, an Outlook data file or a winmail.dat.

When the attachments are out, open them as you would any other, and delete the winmail.dat.

Questions people ask

Is winmail.dat a virus?

No. It is a container Outlook adds when it sends a message in Rich Text format, and it holds the attachments and the formatting. Treat the files that come out of it as you would any attachment from that sender, because they are exactly that.

My attachment is called ATT00001.DAT. Is that the same thing?

Usually, yes. Microsoft's documentation says a mail program that doesn't recognise the TNEF part makes up a generic name like ATT00001.DAT for it. tnef reads the content, not the name: renamed to ATT00001.dat, our test file listed and unpacked the same two attachments.

Can the email viewer on this site open it?

It recognises it and says what it is, but it does not unpack it. Open the mail and you can see the winmail.dat and download it; drop the winmail.dat itself and it tells you it is a TNEF file, not a message. To get the attachments out, use tnef, or ask the sender to resend.

Why does it only happen with one sender?

Because it is a setting on their side: Outlook composing in Rich Text, or an Exchange or Microsoft 365 server that sends Rich Text to outside addresses. Nothing you change in your own mail program stops it arriving.

Does winmail.dat contain anything private?

Microsoft's documentation says it embeds the path of the sender's Outlook data file (.pst) and their sign-in name, visible to anyone who opens it in a text editor. Passwords are not included. It is one more reason for the sender to switch to HTML.

Tools in deze handleiding

Alles draait op je apparaat

Alle handleidingen

/
123 items
Draait in je browser·Je bestanden blijven op dit apparaat
Out0 B
Ready—