winmail.dat problem all of a sudden

Randal, Phil prandal at
Sun Oct 9 00:48:44 IST 2011

I raised the same issue on Sept 27th on this list.

So, you recently updated to 4.84.3?

The problem's in

The previous version works, the current version is broken.

Here's the difference:

@@ -228,7 +228,9 @@
   my($dir, $tnefname, $message, $perms, $owner, $group, $change) = @_;
   # Create the subdir to unpack it into
-  my $unpackdir = "tnef.$$";
+  #my $unpackdir = "tnef.$$";
+  my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir, UNLINK => 0);
+  $dir =~ s,^.*/,,;
   $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
   unless (mkdir "$dir/$unpackdir", 0777) {
     MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could not create subdirectory %s, failed to unpack TNEF message", $tnefname, $message->{id},

Undoing that change makes it all work again.

I don't know perl well enough to understand the code to be able to fix the underlying issue in that change, though.



-----Original Message-----
From: mailscanner-bounces at [mailto:mailscanner-bounces at] On Behalf Of Michael Masse
Sent: 08 October 2011 14:59
To: mailscanner at
Subject: winmail.dat problem all of a sudden

Running MS 4.84.3 on latest Centos 5.   All of sudden I'm getting a 
bunch of incoming messages being quarantined due to: "Could not parse 
Outlook Rich Text attachment"    The TNEF setting for unparable TNEF is 
set to deliver, yet it is not doing so.    This is a new problem that 
just started within the last two weeks.   One oddity I'm noticing is 
that in the quarantine I can usually see the offending attachment 
sitting there extracted next to the df and qf files.    In all of these 
winmail.dat cases, the winmail.dat is not sitting there next to the df 
and qf files so I can't even manually run them against the tnef 
extractor to see if it's truly a problem with tnef not being able to 
extract the files, or if it's a problem with MailScanner not being to 
extract the attachment from the email.  The fact that there is no 
winmail.dat attachment in the quarantine leads me to believe the 
latter.   Any help would be greatly appreciated.   The following are 
what I believe are my relevant MailScanner.conf config lines that have 
to do with TNEF:

Expand TNEF = yes
Use TNEF Contents = replace
Deliver Unparsable TNEF = yes
TNEF Expander = /usr/bin/tnef --maxsize=100000000
TNEF Timeout = 120
MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website! 

More information about the MailScanner mailing list