AW: Problems with TNEF and long filenames

Julian Field MailScanner at
Thu Jan 31 09:37:21 GMT 2008

Hash: SHA1

Ehle, Roland wrote:
>> Ehle, Roland wrote:
>>> Hi all,
>>> I use "Use TNEF Contents = replace" and "Deliver Unparsable TNEF =
>> no"
>>> to get rid of the winmail.dat grab from Outlook clients using Outlook
>>> Richtext Format.
>>> It was brought to my attention, that this setting causes long
>>> filenames to be shortened: For example a file named "test datei mit
>>> sehr sehr langem dateinamen und viel bla bla.txt.txt" arrives as
>> "test
>>> datei mit.txt" at the recipients mailbox.
>>> If I leave TNEF contents untouched, the filename is not changed.
>>> The above happens when using external TNEF decoder and the internal
>>> one. Same behavior with both.
>>> Has somebody experienced the same problem? Any hints to avoid the
>>> problem, other than sending files with long filenames inside a ZIP-
>> file?
>> Do you mean a ZIP file or a TNEF file?
> The problem is TNEF.
> Roland
Well I have found it, but I'm a bit reluctant to change it:

          $safename = $message->MakeNameSafe($_->longname, $dir);
          push @replacements, $safename;
          #print STDERR "Safe name is \"$safename\"\n";
          $message->{entity}->attach(Type => "application/octet-stream",
                                     Encoding => "base64",
                                     Disposition => "attachment",
                                     Filename => $safename,
                                     Path => $filename);

Putting a dangerous filename back in the e-mail is a bit dodgy from a 
security point of view. But I could change
                                     Filename => $safename,
                                     Filename => $_->longname,
which should fix it.

What does anyone think?


- -- 
Julian Field MEng CITP CEng
Buy the MailScanner book at

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

Version: PGP Desktop 9.7.0 (Build 1012)
Comment: (pgp-secured)
Charset: ISO-8859-1


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the MailScanner mailing list