UPDATE: I have an improved version of the script available here.
I'm not going to repeat the many, many websites taking (and complaining) about Microsoft's proprietary e-mail attachment format called TNEF.
I'm assuming that if you are reading this then you have found that these fixes are not working for you (or not possible to enforce). I'll also assume that the LookOut Thunderbird Add-on by Aron Rubin is also not working correctly for you (this was my experience on Ubuntu Edgy Eft).
The best solution I could come up with was getting Thunderbird to run a script to unpack the winmail.dat extension into a folder on your Ubuntu desktop.
It relies on the tnef command-line program, so make sure that is installed first (it's bundled with Ubuntu):
sudo aptitude install tnefBelow is my little script, save it in a file called 'tnef.sh' somewhere and make sure it's executable (
chmod +x tnef.sh
) - or just download it here.#!/bin/bashNow find an email in Thunderbird with a winmail.dat attachment. Double click it and select to open it with the newly saved tnef.sh file:
LOCATION=~/Desktop/winmail.dat
mkdir $LOCATION
/usr/bin/tnef -C $LOCATION --save-body -f $1
Look on your desktop - there should be a 'winmail.dat' directory with the full contents of the attachment.
Double-clicking on any future winmail.dat file will result in the contents of the attachment to also be added to that directory.
Technorati Tags: winmail.dat, TNEF, Thunderbird, Ubuntu, Andrew Beacock
Comments
Please keep up the excellent work on LookOut.
Please keep me informed of any new releases of LookOut and I'll give it another try on Ubuntu soon. :)
#!/bin/bash
#
# open_tnef.sh
#
# Creates a tmp dir, decodes the given TNEF file into that dir,
# and then launches nautilus for viewing.
#
# TODO: instead of letting random dirs accumulate, keep only
# N-most recent dirs, deleting older dirs
#
#
# Make sure given argument is a TNEF file
#
FILE_TEST=`file $1`
if [ "$FILE_TEST" != "$1: Transport Neutral Encapsulation Format" ]; then
echo "Given argument '$1' is not a TNEF file"
exit 1
fi
#
# Set TMPDIR, if not already set
#
if [ "$TMPDIR" = "" ]; then
TMPDIR=/tmp
fi
#
# Create BASE_DIR, if not already created. All TNEF files will be
# decoded into random subdirs of this BASE_DIR.
#
BASE_DIR=$TMPDIR/open_tnef
if [ ! -d $BASE_DIR ]; then
mkdir $BASE_DIR
if [ "$?" != "0" ]; then
echo "Failed to create dir '$BASE_DIR'"
exit 1
fi
fi
#
# Name of given TNEF file will be used to create a random subdir
# to hold its contents
#
TNEF_FILE_NAME=`basename $1`
#
# Create a random subdir for contents of given TNEF file
#
CONTENT_DIR=`mktemp -d $BASE_DIR/$TNEF_FILE_NAME.XXXXXXXXXX`
if [ "$?" != "0" ]; then
echo "Failed to create dir '$BASE_DIR/$TNEF_FILE_NAME.XXXXXXXXXX'"
exit 1
fi
#
# Open the given TNEF file into the content dir
#
tnef --number-backups -C $CONTENT_DIR -f $1
if [ "$?" != "0" ]; then
echo "Failed to decode given TNEF file '$1'"
exit 1
fi
#
# View the content dir
#
nautilus $CONTENT_DIR
if [ "$?" != "0" ]; then
echo "Failed to launch nautilus"
exit 1
fi
I was convinced that LookOut wasn't working for me on Fedora Core 6. If I "Save As" or "Detach", it would ask me where I wanted the file. After choosing a destination directory, I found no files. I did this over and over again, disabling various other Thunderbird Extensions along the way, to see if I could uncover the source of a conflict...
Alas, nothing worked.
After a bit of searching, however, I found the attachments successfully detached into /tmp, all 17 copies of them (from the 17 times I tried it -- oops!).
#!/bin/bash
WINMAIL=$1
DATETIME=$(date +%Y%m%d-%H%M)
LOCATION="/tmp/winmail.dat.$DATETIME"
/usr/bin/clamtk $WINMAIL
mkdir "$LOCATION"
cd $LOCATION
/usr/bin/tnef -C "$LOCATION" --save-body -f $WINMAIL
/usr/bin/nautilus "$LOCATION" &
rm -rf'ed that dir, and reinstalled lookout.xpi as user me, et voila!
cheers mark