Clicking an ad above is just as good as giving me a donation

tnefclean home page

I NEED FEEDBACK

This tools works absolutely great for me. I want to know how well it's working for you. If it either does not work the way you expected, or you couldnt figure out how to get it to work at all, I want to know!
If this script is the answer to all your prayers and you want to nominate me for People magazine's "Person of the year", I want to know!

What is it?

tnefclean is a simple perl script which is meant to process incoming email and clean up the MS-Outlook generated TNEF attachments so that the attachments you see appended to incoming email are the attachments the sender meant for you to see. You'll never see another winmail.dat file again!

I wrote this because I couldn't find anything like it on the Internet. Maybe I didn't look hard enough.

Basically, it seems like the non-Outlook email users of the world have simply accepted that the best they can hope for when receiving those annoying messages from outlook users with the stupid winmail.dat attachments is a tool like Fentun which basically allows you to crack open a winmail.dat file when you receive one.

While Fentun is a wonderful tool which I have used for a long time and have had many occasions to be thankful for, it annoyed me that email from Outlook users almost always had an attachment, whether that attachment was empty or not. It also annoyed me to have to click on the winmail.dat file to figure out what was inside.

I wanted something that would intercept email on the fly and modify it so that I could see the attachments normally when they are there, and see nothing when they aren't. Several hours of google later, I started writing tnefclean.

Howzit work?

When tnefclean reads a message, it splits it into its various parts. If one of those parts is found to contain a TNEF attachment (winmail.dat) it decodes that part and tries to extract the contents of the winmail.dat. It then reassembles the message, including the newly discovered attachments, in standard MIME.

If after all that, the message is found to contain no body and only one text attachment, then the message is altered so that it looks right upon receipt.

When your mail reader gets the message, it actually looks NORMAL.

tnefclean can either be run out of your .forward file, or as a filter in either your mail program or your .procmailrc file.

tnefclean is written in perl and requires NO additional perl modules to run.
It does, however, require that the following two tools be installed:

mimencode - part of the metamail package.
ytnef - Yerase's TNEF Stream Reader (Recommended)
or
tnef - the very useful tnef unpacker

How do I install it?

The easy way

Retrieve the bundled tnefclean package. Unpack it using gzip and tar. Change to the directory that was created and run ./setup.sh. Answer all the questions and follow the instructions.

The not quite as easy way

First, you MUST edit tnefclean.pl and set the config variables appropriately. Next, well, you have several options. Here's how I've got it set up.

I retrieve my email via a pop server. Luckily, I have a shell account on that pop server. It uses sendmail as its MTA. So the first thing I did (after I wrote the tool) was to edit the configuration options in the beginning of the script. Then I just added the following to my .forward file.

	| /path/to/tnefclean.pl
Using the above method, sendmail forwards all incoming email to tnefclean which then does its thing and finally places the processed email into the mail spool.

tnefclean can also be used as a filter if the -f option is specified. In this case, it sends its output to stdout rather than the spool file. This way, tnefclean can be invoked from within your .procmailrc (for example) like this:

	:0fw
	| /path/to/tnefclean.pl -f

How do I get it?

You have two options.

Option 1 - the bundled package

This bundle includes tnefclean.pl, setup.sh, linux and solaris executables for mimencode, ytnef and tnef.

Download tnefclean-2.2.tar.gz

Option 2 - pick and choose

You'll need one from each.

TNEFCLEAN: tnefclean.pl

MIME encoder/decoder:

Linux x86 executable - Most linux distributions have this already installed.
Solaris executable
metamail source
TNEF expander:

How do I contribute?

Send me email! Just read between the lines to get my email address: LINEstriker@dread.netLINE

One thing you should know: I am not interested in modifying this script to use perl modules that are not distributed with perl. ie: no CPAN stuff. Why? Because if you happen to be doing this on a system with no connection to the Internet, it's a PAIN!

That said, I know that my perl skills are far from impressive. There are probably many better and faster ways to do what I've done. If so, be my guest. I'm very open to any READABLE patches.

If you have time to waste, check out my MS spoof page: Mycrosoft Corporation

Thanks!