Accessing winmail.dat attachments from Mozilla on Linux


Overview

Microsoft uses a "application/ms-tnef" mimetype to encapsulate it's email messages. Sometimes you need to be able to get to the contents of them for example when they contain documents and zip files. Sourceforge has a tnef unpacker which can be used for this and you can get mozilla to pass the winmail.dat attachment to tnef and then show the unpacked contents in your favourite file browser

Installation

Download and Install tnef http://sourceforge.net/projects/tnef/

tar -zxvf tnef-1.2.1
cd tnef-1.2.1
./configure --prefix=/opt
make
su -c 'make install'


Create a wrapper script for Mozilla to execute and pass the winmail.dat attachment to tnef for unpacking

touch /usr/local/bin/tnef.sh
vi /usr/local/bin/tnef.sh

Enter the following into tnef.sh

#!/bin/sh

# wrapper script to unpackage winmail.dat attachments in mozilla

# This can be anywhere you think is a good place to unpack stuff to
UNPACKTO=~/mail/tnef

TNEF=`which tnef`
# put your favourite file browser in here
FILEBROWSER=`which konqueror`
FILE=$1

$TNEF --file=$FILE --directory=$UNPACKTO --number-backups

$FILEBROWSER file:$UNPACKTO

Make tnef.sh executeable

chmod +x /usr/local/bin/tnef.sh

In Mozilla open one of your emails that contains a winmail.dat attachment in it. When Mozilla prompts you for a program to launch the winmail.dat attachment associate it with the wrapper script




[email protected]