Problem winmail.dat and TNEF

Jeff Mills Jeff.Mills at
Wed Feb 22 22:47:37 GMT 2012

I have tried the patch, but it still doesn't work for me, so I have switched back to internal tnef.

Feb 23 09:39:32 S1 MailScanner[29355]: Expanding TNEF archive at /var/spool/MailScanner/incoming/29355/24911D3E13B.A7DDB/winmail.dat
Feb 23 09:39:32 S1 MailScanner[29355]: Trying to unpack nwinmail.dat in message 24911D3E13B.A7DDB, could not create subdirectory 24911D3E13B.A7DDB//tnef244e4i, failed to unpack TNEF message
Feb 23 09:39:32 S1 MailScanner[29355]: Corrupt TNEF winmail.dat that cannot be analysed in message 24911D3E13B.A7DDB

My code looks like this now:
# Create the subdir to unpack it into
  #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},
    return 0;


Jeff Mills

Sydney Technology Solutions Pty Ltd
Unit F10, 101 Rookwood Road
Yagoona, New South Wales 2199
Phone:   02 8212 4722
Email:    Jeff.Mills at
Web :

Living our values, achieving success

Sydney Technology Solutions' operating philosophy is based on honesty, enthusiasm, respect, ownership, excellence and service. These values guide the way we manage our business and the way we service yours.

P Please consider the environment before printing this email

Sydney Technology Solutions accepts no liability for the
content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

-----Original Message-----
From: mailscanner-bounces at [mailto:mailscanner-bounces at] On Behalf Of Andrew Colin Kissa
Sent: Thursday, 23 February 2012 3:31 AM
To: MailScanner discussion
Subject: Re: Problem winmail.dat and TNEF

On 22 Feb 2012, at 12:36 PM, Randal, Phil wrote:

> Thanks Andrew.
> Now someone with write access needs to get it into the Git repository.

I have sent it to jules maybe he will find sometime to push it to github.

> and where i can download : mailscanner-fix-tnef.patch ?
> i dont find this in mailscanner folder download from mailscanner website

If the attached version is mangled by the mailing list you can download it


MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website!

This email has been scanned for viruses and dangerous content by
Sydney Technology Solutions MailMaster Email Protection Services.

For more information please visit
:Scanned by MailMaster1:

More information about the MailScanner mailing list