This question is somewhat long, but I spent hours on it to no avail. I have a code that generates an email file on a web server and allows the user to download this email and open it in Outlook. From here, they can make various changes to the email before sending them to heaps of people.
I am currently creating a .OFT file, which is basically an email template. I want to create a .MSG file, which is the actual email address. From a binary point of view, it seems that these file formats are identical. They have the same identifiers and stream properties.
My approach was to first create an empty email message in Outlook, and then just save it in the Base.oft file. In my code, I open a document and change the thread identifier __substg1.0_1013001E
, which is the identifier for the body of the HTML email. Then I save the file and write it to the cyclone. It works great.
I tried the same approach with MSG format. I created an empty email, saved it as Base.msg, and changed the same stream id. If I look at the resulting file, the new body is actually saved there. However, if I open the letter, the body will remain empty.
What's even weirder, if I type the body in Outlook and save it in the base file, I can see this body under stream 0_1013001E. If I then modify this stream with a different body, I can verify that the new body is indeed saved in the file, but if I open the message in Outlook, I will see the old, original object. As if the email body is stored elsewhere in the file for the .MSG format, however, I looked through each stream and cannot find anything that looks like it could be the email body.
Maybe. MSG files are encrypted or are their bodies stored in some native binary format, unlike .OFT files? Hopefully someone has some idea about this as I was browsing the internet and mostly not found in these formats.
Update:
It seems that the .MSG format stores the body in Stream ID __substg1.0_10090102
- which is encoded in some binary form (not sure what.) If I delete the stream (or set it to one \0
, the file becomes damaged.