Message headers (DATE) lost when saving as .eml :: mhtml


Using MyStorage As PersonalStorage = PersonalStorage.FromFile(“ost.ost”)
MyStorage.SaveMessageToStream(ID, MyStream)
Dim MyMailMessage As MailMessage = MailMessage.Load(MyStream, LoadOptionsMSG)
MyMailMessage.Save(“D:\eml.eml”, SaveOptionsMHT)

Although SaveOptionsMHT.PreserveOriginalDate = True, but still the headers like Date is lost!
Full options:

DecodeSignedContent = True
KeepOriginalEmailAddresses = True
PrefferedTextEncoding = Encoding.UTF8
PreserveEmbeddedMessageFormat = True
PreserveTnefAttachments = False

CheckBodyContentEncoding = True
PreserveOriginalBoundaries = True
PreserveOriginalDate = True
RenderedContactFields = Email.ContactFieldsSet.AllExisting
SaveAttachments = True
SkipInlineImages = False
MhtFormatOptions = All…

Output headers:
Untitled.png (32.9 KB)

*Update 2: immediately after extraction, if we load it in MapiMessage we can get DeliveryTime and ClientSubmitTime :frowning:

We have logged this problem in our issue tracking system as EMAILNET-40837. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

Not inconvenience, already found a workaround, just trying to make the lovely Aspose Email SDK better :slight_smile:

It is nice to hear from you that you have found the workaround of this issue.

It is to inform you that the issue which you are facing is actually not a bug in Aspose.Email. So, we have closed this issue (EMAILNET-40837) as ‘Not a Bug’.

You saves the message in MHTML (SaveOptionsMHT) format, which has only 2 headers - MIME-Version: and Content-Type:, as is done in Outlook.

Although I have a not-so-fine workaround for that, but please consider:
When extracting some items from pst/ost/olm like contacts or calendars or tasks, I use mhtml as target format to have the special formatting of mhtml, for showing purposes.
Now developers are loosing such headers when converting to mhtml.
But the fact is that: adding those headers does not violate the RFCs.
Open Chrome/Edge and save a page as mhtml, you’ll have:

From: < Saved by Blink >
Subject: -page title-
Date: Sat, 3 Dec 2022 23:43:46 -0000
and go on…

If you consider it as Not a Bug, I think at least is a loss of some headers, a destructive conversion.
So I think it’s wise to add a SaveOption to include such headers (not done in Outlook, but is also not violating any RFC)
Can you please kindly add a ticket for that to be considered? Should not be a big deal :slight_smile:

Can you please kindly add a ticket for that to be considered? Should not be a big deal

Added: EMAILNET-40869