verdammelt / tnef

tnef

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tnef fails to parse/extract winmail.dat

pasikarkkainen opened this issue · comments

I'm trying to extract attachments from winmail.dat file by using tnef, but it seems tnef is unable to parse the file for some reason. The file is expected to include calendar invitation, originating from MS Exchange 2010.

$ tnef winmail.dat
$ tnef -f winmail.dat --list
$ tnef -f winmail.dat --list -v
$ tnef -C tempdir -f winmail.dat

eg. all the above output nothing.. If I enable the "--debug" flag then I'll get lots of output, as promised by the usage/help text :)

Any tips about how to get the file contents parsed/extracted? Thanks!

I'm using tnef-1.4.18-1.el7.x86_64 rpm.

I'd think any of the above would get you contents of the file if there were any.

The purpose of my TNEF program was to unpack attachments that were contained in the ms-tnef formatted file. Not sure if the calendar invite you expect is an attachment or just otherwise contained in the ms-tnef format.

If you can provide me with the winmail.dat file I can investigate further. If the file is confidential and you cannot attach it here, but you still trust me with it, then you can email it to me at the address you will find under the --help output, or main page etc.

yeah, it seems the file doesn't have any real attachments in it, but instead it has the MAPI calender invitation as Objects and Properties.. it seems "tnefparse" tool is able to parse the file, like this:

$ tnefparse -o winmail.dat  -b

Overview of winmail.dat:

  Attachments:


  Objects:

    TNEF Version
    OEM Codepage
    Message ID
    Priority
    Date Sent
    Date Modified
    Message Class
    Subject
    Date Start
    Date End
    Owner Appointment ID
    Response Requested
    MAPI Properties

  Properties:

    MAPI_TNEF_CORRELATION_KEY
    MAPI_SENT_REPRESENTING_NAME
    MAPI_SENT_REPRESENTING_EMAIL_ADDRESS
    MAPI_SENT_REPRESENTING_ADDRTYPE
    MAPI_SENT_REPRESENTING_ENTRYID
    MAPI_SENT_REPRESENTING_SMTP_ADDRESS
    MAPI_SIP_ADDRESS
    MAPI_SENDER_NAME
    MAPI_SENDER_EMAIL_ADDRESS
    MAPI_SENDER_ADDRTYPE
    MAPI_SENDER_ENTRYID
    MAPI_SENDER_SMTP_ADDRESS 
    MAPI_SEND_RICH_INFO
    MAPI_MESSAGE_CLASS
    MAPI_MESSAGE_LOCALE_ID   
    MAPI_SEND_RICH_INFO
    MAPI_MESSAGE_CODEPAGE
    MAPI_SEARCH_KEY
    MAPI_IMPORTANCE
    MAPI_CLIENT_SUBMIT_TIME  
    MAPI_LAST_MODIFICATION_TIME
    MAPI_OWNER_APPT_ID
    MAPI_START_DATE
    MAPI_END_DATE
    MAPI_READ_RECEIPT_REQUESTED
    MAPI_ORIGINATOR_DELIVERY_REPORT_REQUESTED
    MAPI_LAST_MODIFIER_NAME  
    MAPI_REPLY_REQUESTED
    MAPI_RESPONSE_REQUESTED  
    MAPI_SUBJECT
    MAPI_SUBJECT_PREFIX
    MAPI_SENSITIVITY
    MAPI_ORIGINAL_SENSITIVITY
    MAPI_CONVERSATION_INDEX  
    MAPI_CONVERSATION_TOPIC  
    MAPI_SMTP_MESSAGE_ID
    MAPI_INTERNET_CODEPAGE   
    MAPI_ICON_INDEX
    MAPI_CREATION_TIME
    MAPI_ALTERNATE_RECIPIENT_ALLOWED
    MAPI_PRIORITY
    MAPI_RECIPIENT_REASSIGNMENT_PROHIBITED
    MAPI_NON_RECEIPT_NOTIFICATION_REQUESTED
    MAPI_TARGET_ENTRY_ID
    MAPI_CONVERSATION_ID
    MAPI_CREATOR_NAME
    MAPI_CREATOR_ADDRESS_TYPE
    MAPI_CREATOR_EMAIL_ADDRESS
    MAPI_SENDER_SIMPLE_DISPLAY_NAME
    MAPI_SENT_REPRESENTING_SIMPLE_DISPLAY_NAME
    MAPI_CREATOR_SIMPLE_DISP_NAME
    MAPI_LAST_MODIFIER_SIMPLE_DISPLAY_NAME
    MAPI_INTERNET_MAIL_OVERRIDE_FORMAT
    MAPI_MESSAGE_EDITOR_FORMAT
    MAPI_STORE_SUPPORT_MASK  
<body text goes here>

It seems some other tools parse the MAPI fields above and generate .ics attachment out of them.. it would rock if tnef could do that aswell, but I don't really know how difficult that will be.

Difficulty depends upon what we'd want to do with the calendar data - dump a .ical file or something like that?

This would also be an extension beyond the original intent of tnef. I am likely not to have the time or energy to add this feature myself to be honest. But would be happy to review PRs :)

If this other application suits your needs better than tnef then it may be a better fit for this task.

@verdammelt yeah, I was thinking of dumping out .ics file, just like tnef extracts/dumps other actual attachments from winmail.dat.

I guess it's time to do some research around the topic and see how difficult it'd be to generate .ics files out of the mapi objects/properties.

Good luck. I'll leave this issue open for now in case you, me or anyone else has ideas or suggestions for adding the dumping of calendar info into tnef.

commented

I just ran into the same problem. --debug shows all the actual invite data buried in lots of other stuff I don't understand, but it's not part of the text of the message, so --save-body does not show it. The beginning of the --debug output follows, in case it might provide any hints.

(MESS) TNEF Version <9006> [type: dword <0008>] [len: 4] = 0x00010000
(MESS) OEM Codepage <9007> [type: byte <0006>] [len: 8] = CodePage - Primary: 1252, Secondary: 0
(MESS) Message ID <8009> [type: string <0001>] [len: 33] ='D57D638B6C8D334B8D19D8C9A6D76736'
(MESS) Priority <800d> [type: short <0004>] [len: 2] = 2
(MESS) Date Sent <8005> [type: date <0003>] [len: 14] = Fri 2021/08/20 18:22:42
(MESS) Date Modified <8020> [type: date <0003>] [len: 14] = Fri 2021/08/20 18:22:42
(MESS) Message Class <8008> [type: word <0007>] [len: 30] = 0x5049 0x2e4d 0x694d 0x7263 0x736f 0x666f 0x2074 0x6353 0x6568 0x7564 0x656c 0x4d2e 0x6774 0x6552 0x0071
(MESS) Subject <8004> [type: string <0001>] [len: 52] ='RBAC Meeting: Opening up Data Access in dentataBase'
(MESS) Date Start <0006> [type: date <0003>] [len: 14] = Fri 2021/08/27 16:00:00
(MESS) Date End <0007> [type: date <0003>] [len: 14] = Fri 2021/08/27 17:00:00
(MESS) Owner Appointment ID <0008> [type: long <0005>] [len: 4] = 2681505765
(MESS) Response Requested. <0009> [type: short <0004>] [len: 2] = 1
(MESS) MAPI Properties <9003> [type: byte <0006>] [len: 22660] = 0xbb [snip lots more]

commented

I'm curious if you closed this as done, or as not going to be done? Some minimal comment might save someone re-opening or opening a new issue for the same problem, if it's not going to solved unless someone submits a PR.
Thanks.

I'm curious if you closed this as done, or as not going to be done? Some minimal comment might save someone re-opening or opening a new issue for the same problem, if it's not going to solved unless someone submits a PR.
Thanks.

Thought I had left a comment - apologies for not doing so. I'd be happy to look at PRs for this - but I am not going to do any work on this.