ytnef icon indicating copy to clipboard operation
ytnef copied to clipboard

HTML & Text message parts

Open amit777 opened this issue 4 years ago • 8 comments

Hi, I've been experimenting with this tool and comparing it to the regular tnef tool on linux. I noticed that the regular tnef tool is able to extract the HTML and TEXT parts of a winmail.dat message (along with RTF if it's there). Is it possible to do the same with this lib?

amit777 avatar May 02 '20 20:05 amit777

I'm sure it can... Can you provide a sample file for testing?

Yeraze avatar May 02 '20 21:05 Yeraze

Sure, I'm going to do a couple more tests and compile the results and send them to you. Is it ok if I email you some of the test files since they have some semi-private data in them?

amit777 avatar May 02 '20 22:05 amit777

Sure, that's fine.

Yeraze avatar May 02 '20 22:05 Yeraze

Actually, I just noticed ytnefprint does seem to find the field and the data in that field looks correct:

 #1: Type: [ BINARY  ]  Code: [PR_BODY_HTML]
    Size: 487    Value: [<html>..<head>..<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">..<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>..</head>..<body dir="ltr">..<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">..<span style="font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">[[#]]</span><br>..</div>..</body>..</html>..]

So, I guess my next question is does the ytnef binary allow exporting that as message.html or something similar?

amit777 avatar May 02 '20 22:05 amit777

Ahh, I see in the ytnef/main.c the saveRTF flag.. looks like there needs to be another flag for the HTML body. I'm going to continue playing around with this. If I find any TNEF's that don't parse correctly, will send it over to you. I feel like I found one that was causing a seg fault yesterday..

amit777 avatar May 02 '20 23:05 amit777

I was working on creating a pull request for a couple enhancements. But I was hoping you could clarify this part of the lib/ytnef.h code:

#define attAttachData               ATT( atpByte,       0x800F) /* PR_ATTACH_DATA_xxx */
#define attAttachTitle              ATT( atpString,     0x8010) /* PR_ATTACH_FILENAME */
#define attAttachMetaFile           ATT( atpByte,       0x8011) /* PR_ATTACH_RENDERING */

Where do the 0x800F, 0x8010 and 0x8011 come from? Are they defined in some standard somewhere?

amit777 avatar May 03 '20 02:05 amit777

Not really, TNEF (afaik) is something Microsoft made up.. You'll find lots of references to it in the Public Microsoft documentation like this : https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessageflags-canonical-property

Yeraze avatar May 03 '20 19:05 Yeraze

I created a pull request for the HTML body export as well as some additional header defs. https://github.com/Yeraze/ytnef/pull/83

Hopefully it fits your desired coding style! Thanks again for creating this awesome lib.

amit777 avatar May 05 '20 19:05 amit777