Some email messages contain the attachments in a format called TNEF (Transport_Neutral_Encapsulation_Format). This attachment is usually called
winmail.dat. Extraction tools exist for linux, but originally these are meant to be opened by Outlook.
I have a large directory hierarchy with stored mail in MailDir format.
How would I best go about to:
- Best detect messages in sub-folders containing winmail.dat
- Cut out the winmail.dat, unpack it
- "reassemble" the email.
I can sort-of imagine a "crude/naive" way, something with grep/perl for finding/cutting, lots of temporary files, and then catting extracted/7bit_converted pieces back together into a (hopefully) valid email structure.
Can somebody think of a better way, perhaps using more appropriate tools. I'd also be interested in any Got-Chas you can come up with, or first-hand accounts of similar endeavors.
In my wildest dreams, somebody here has written/seen use of some cool framework in e.g. python to accomplish something like "Recursively frobnicate some_property of eMail in MailDirs matching some_condition".
Replacing the "meat" of that with something that calls
tnef -xyz would serve my immediate need, but having a nice "example" like this will surely be useful for lots of other use-cases not only for myself.