Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
199 stars 55 forks source link

Issue with third party previewer - fixed #101

Closed jebbster88 closed 1 year ago

jebbster88 commented 1 year ago

Hey

Just leaving a note here in case anyone has a similar problem.

I had a third party MSG previewer fall over on emails generated by MsgKit, as I had no access to any logging, I resorted to doing binary compares (and using OpenMCDF's structured storage explorer) to compare the MsgKit email and that same email after having been run through MFCMAPI.

The two things that jumped out at me were.

  1. The order of the storage entries differed after MFCMAPI touched the files.
  2. MFCMAPI removed 4 bytes (0's) from the end of the __properties.version1.0 storage entry.

I addressed point 1, by having Message.cs initialise the Properties stream in it's constructor. Which resulted in me having the same order in the two files, making comparing much easier. But it wasnt until I addressed point 2 that my problem went away, this was achieved by just removing the blank 4 byte insertion in Properties.cs/WriteProperties within the Message size insertion block.

Greg

Sicos1977 commented 1 year ago

Fixed in latest commit. Don't know why I added those 4 bytes but probably read it somewhere. The MSG file seems to work without problems when opening it in Outlook when the 4 bytes are removed.