Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Decoding Microsoft (Outlook) Attachments

Around this time of year, people share a lot of photos.  Pictures of 
friends, family, the kids, their pets, their Christmas trees etc.  The 
problem is that many of these people are chained to a Microsoft email 
empire, and thus using email software that

    a) writes html-formatted (or Rich Text) messages by default
    b) encodes attachments in a proprietary way

You yourself have probably seen these messages, where the sender claims 
to have attached some photos, but all you see is something called "Part 
1.2" or "Winmail.dat"  If you try to open this attachment, you will see 
that it is encoded as type application/ms-tnef. It is unlikely that your 
Linux system will know what to do with it.  This message is meant to 
share with you the utilities that exist to help you receive your 
Microsoft-using counterparts with the humble grace and compassion 
appropriate for the season.

ms-tnef stands for "MicroSoft Transport Neutral Encapsulation 
Format"[1], which, because it comes from Microsoft, is neither neutral 
nor formatted the way standard MIME mail messages are encoded.   
Although I haven't tested this, some Windows versions of free software 
may decode these messages automatically by calling on some Windows dll.  
Still, it would be nice to decode them on a free operating system.

Enter the linux utility tnef[2].  tnef is a command-line utility that 
can unpack those pesky Microsoft attachments, and is actually included 
in many (most?) modern Linux distributions.  If you do not have it, you 
can download it from the tnef project site on

My Debian Sarge includes a GUI version called ktnef that I is bundled 
with KDE and integrated into KMail.  Located at /usr/bin/ktnef on my 
system, this utility can be launched and allows you to visually open, 
examine the contents of, and extract the ms-tnef attachments.  Since I 
use Mozilla for email, it doesn't know what to do with these ms-tnef 
attachements.  So, you must first save the attachment in question before 
using the utility. 

To avoid this two-step process of saving the attachment and launching 
the utility independently, you will want to register the ktnef 
application as a helper for Mozilla[3].   Open Mozilla and under the 
'Edit->preferences->Navigator->helper applications' menu, you will want 
to associate "application/ms-tnef" with the command "/usr/bin/ktnef".  
(To find the correct location of the program on your system, issue this 
command at the command shell: 'locate ktnef')  Once you have made this 
association, you can restart Mozilla and it will be ready to launch 
ktnef automatically whenever you open such an attachment.

Don't want to bother with any setup?  There is a nice free service at 
this website[4] that will decode your attachments for you.  It is a PHP 
script that hooks into tnef on the backend.  Want to share the goodness 
of tnef with other people?  The neat little PHP script is released under 
the GPL.  You can download the source from that website and setup your own.

System Administrator?  Maybe you would like it if you never saw another 
ms-tnef or winmail.dat attachment ever again.  Check out tnefclean, a 
perl script that filters out the ugliness, and by the time you see your 
email, it looks the way [insert deity] intended it to.

If the sender is both competent, and open to suggestion, you may be able 
to suggest to them that they send text-formatted emails[6], and that way 
any attachment should come across with the correct MIME encoding, rather 
than encapsulated in ms-tnef.

[3] The Mozilla project just released version 1.0 of Thunderbird, which 
automatically imports your Mozilla mail settings and messages, so you 
may want to check that out too.  I assume that it is a similar process 
to hook up ktnef with Thunderbird.

p.s. If you would like to reference this article, or edit sections of 
it, it is available at the Newburyport GNUS website at

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /