Bug 473691

Summary: KTnef 23.04.1 can not open winmail.dat, but Thunderbird is able to convert into text/plain
Product: [Applications] ktnef Reporter: Elmar Stellnberger (AT/K) <estellnb>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mageia RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description Elmar Stellnberger (AT/K) 2023-08-23 18:09:21 UTC
used: ktnef-23.04.1-2.mga9, arch i686, Mageia 9
used: thunderbird-102.12.0-1.mga9, arch i686
used: tnef 1.4.18, commit 1810f3a 45459a2, arch i686, self-compiled
kernel: 6.3.9-desktop-1.mga9 #1 SMP PREEMPT_DYNAMIC Wed Jun 21 16:54:49 UTC 2023 i686

ktnef displays a GUI alert/message box that says "Opening file winmail.dat not possible" (original text: "Das Öffnen der Datei „winmail.dat“ ist nicht möglich."). KTnef will run and hold its main window open, but no file or content appear to be displayed, although it says "winmail.dat - KTnef" in the title bar. It is possible to make a "save message text to file" which results in an empty file, zero bytes long. Viewing as ritch text says "no rtf in this document" and opening ktnef without any command line parameter afterwards (i.e. without winmail.dat) the file that was opened last (or not) isn´t viewed under actual documents (which appears to be a list similar to last opened in libreoffice-writer).

If you inspect winmail.dat with 'od' or 'vim -MR/:set wrap on', you don´t see more than a few SMTP-headers. If you attach the winmail.dat within a Thunderbird Email directly, it will be decoded into text/plain. Saving this text/plain as .eml and opening it with Thunderbird again, you get an empty Email with same or similar headers as the envelope had. The winmail.dat itself was an attachement inside an attached .eml (as you will often encounter; however in Σ a 3-time nest/wrap excluding the top-Email) and thus Thunderbird´s only offer about it was saving to disk (or on my other machine opening it with ktnef, which didn´t do the trick either).

  Here you can find the attachements: https://upload.elstel.info/corr/DKB-edr/ (ask-me42copy2this-report)
  Here is what the tnef command line program does (see at https://github.com/verdammelt/tnef/issues/47):
> tnef --ignore-cruft -v [--list] -f winmail.dat
WARNING: garbage at end of file (ignored)
> no content extracted, no files listed
Comment 1 Elmar Stellnberger (AT/K) 2023-09-06 18:48:30 UTC
  Neither would jtnef-2.1.0 from freeutils.net/source/jtnef/ do the trick:
x=*.jar; LANG=C echo java -cp "${x// /:}" net.freeutils.tnef.TNEF ./winmail.dat
processing TNEF file ./winmail.dat
java.io.IOException: Invalid attribute level: 13
at net.freeutils.tnef.TNEFInputStream.readAttr(TNEFInputStream.java:155)
at net.freeutils.tnef.Message.read(Message.java:68)
at net.freeutils.tnef.Message.(Message.java:56)
at net.freeutils.tnef.TNEF.extractContent(TNEF.java:49)
at net.freeutils.tnef.TNEF.main(TNEF.java:134)
Operation aborted.