Open Winmail.Dat

Microsoft Outlook emails are stored in a special archive file format (MIME type ms-tnef) called winmail.dat. What follows is a basic Shell Script to open / extract the contents of a Microsoft Outlook winmail.dat file.

TNEF is a Linux Command Line program / tool that open /extracts content from ms-tnef formatted (like winmail.dat) files.

Install TNEF via the Ubuntu Software Center or from Terminal Session with:

sudo apt-get install tnef

The TNEF Man Page can be found at:

A typical usage of TNEF is:

tnef --file=/foldername/winmailfilename --directory=outputfoldername

Here is a Shell Script to ease the process:


# Open Microsoft Outlook Emails (MIME type ms-tnef)
# Options -
# -t - list attached files, do not extract
# --file= - specify complete path and file name to process
# --directory= = specifies loaction where winmail contents are deposited

read -p "Key-in complete winmail path and filename: " winmailfilename
read -p "Key-in directory to contain winmail content: " outputdirname
read -p "List winmail contents? (y/n) " answer
if [ "$answer" == "y" ]
    echo "Listing winmail contents..."
elif [ "$answer" == "n" ]
    echo "Opening winmail file..."
    optListOnly=" "
  echo "Bad reply, try again."

tnef --file=$winmailfilename --directory=$outputdirname $optListOnly