Search code examples
c#.netoutlookmsgkit

Outlook doesn't show date on the preview when eml is converted to msg using msgkit


i tried converting the .eml to .msg in c# using msgkit so my .eml file looks like this

Date: Thu, 30 Jan 2020 12:09:26 +0530

its a simple .eml file i tried converting the .eml to .msg using online converter as well when viewed from ole compound viewer the files look almost the same but the msgkit converted one doesn't show recieved date in the preview when opened with outlook. online converted shows received date correctly but the one converted using msgkit says None .I want to know what parameter does outlook look for when picking up the recieved date on preview. i tried giving different properties as well from https://github.com/vikramarsid/msg_parser/blob/master/msg_parser/properties/ms_props_id_map.py

outlook preview


Solution

  • Make sure PR_CLIENT_SUBMIT_TIME (0x00390040) and PR_MESSAGE_DELIVERY_TIME (0x0E060040) MAPI properties are set.

    You can take a look at the resulting MSG file and its properties in OutlookSpy (I am its author) - click OpenIMsgOnIStg button.

    Also, if using Redemption (I am also its author) is an option, converting EML to MSG is as simple as

    RDOSession session = new RDOSession();
    RDOMail msg = session.CreateMessageFromMsgFile(@"c:\temp\test.msg");
    msg.Import(@"c:\temp\test.eml", rdoSaveAsType.olRFC822);
    msg.Save();