koodaamo / tnefparse

a TNEF decoding library written in python, without external dependencies
GNU Lesser General Public License v3.0
49 stars 37 forks source link

Cannot pull ics file #16

Closed dugite-code closed 5 years ago

dugite-code commented 6 years ago

Python: 3.5.3 tnefparse installed from pip Windows 10

I'm trying to parse a winmail.dat file from a appointment invite email. Using lookout (fix version) in thunderbird I can see a rtf file, the ics file and a vcf file. Using:

    for part in msg.walk():
        if part.get_content_type() == 'application/ms-tnef':
            tnef = TNEF( part.get_payload( decode=True ) )
            for attachment in tnef.attachments:
                print(attachment.name)

I get this output:

WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'TNEF Version'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'OEM Codepage'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Message ID'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Priority'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Date Sent'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Date Modified'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Message Class'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Subject'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Date Start'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Date End'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Owner Appointment ID'>
WARNING:tnef-decode:Unknown TNEF Object: <TNEFObject 'Response Requested'>

It looks like the calendar is being parsed as TNEF Objects. Any advice?

petri commented 6 years ago

Is that all the output you got? Your code should show the attachment names as well. Do you have a problem getting at the ics file?

What it comes to the warnings, well, tnefparse logging is a bit of a mess, please see #18. If you can add some suggestions there, it'd be helpful.

jrideout commented 5 years ago

@dugite-code Do you still have any issues we can help you with?

dugite-code commented 5 years ago

Possibly not? The Thunderbird's lookout plugin did pull files out but it looks like it may have been a simple case of a corrupted file, a random zero width character was getting printed out in the lookout logs so that might have been the source of my issues.

image

I'll give tnefparse another go at some point soon since there have been a couple of updates since then