Free Support Forum - aspose.com

After save Outlook Msg to Html not preserving original date in Aspose Email

After Processed a Msg in Aspose Email i can save it to Html.But after processing in aspose when i opened it is not showing original date.
my code sample
objectName = txtEmlFldr + “\message” + “" + fileName + "” + Now.Ticks.ToString
Dim options As HtmlSaveOptions = SaveOptions.DefaultHtml
options.EmbedResources = True
options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader Or HtmlFormatOptions.WriteCompleteEmailAddress
If (msg IsNot Nothing) Then
msg.Save(objectName + “.html”, options)
successfulTblRow.Item(“File format”) = “html”
End If

@sureshkumarg

Can you please try using latest Aspose.Email for .NET 20.11 on your end. In case there is still an issue then please share the source MSG file and generated HTML with us. Please share the snapshot highlighting the issue.

I am using 20.11 dll.But the Problem is there.Supoose the exact time is 11/22/2020 9:10:20 PM
it is showing Sun, 22 Nov 2020 22:10:20 -0500.So it is showing 1 hr plus.It is happening with one html not with msg. another problem i want the html should be 12hr format.
Above code allready there.

@sureshkumarg

You can please consider setting the TimeZone for MailMessage before saving to MHTML as MS Outlook always shows time in user’s timezone.

For HTML it is not possible, HtmlSaveOptions does not contain needed settings. As a workaround, you can save in MHTML first using MhtSaveOptions by setting Timezone settings and then load in MailMessage from MHTML and then save to HTML without headers(headers will be taken from MHTML). I hope this will help.

I suppose you have requested this question in another forum thread as well and it has been responded over following link.

still date is showing 1 hr extra.

It is also not converting to 12 hr format if u see my earlier mail thread alo i replied.

Please consider implementing the suggested approach.

I am not asking about outlook and html will open in browser .After saveing it is showing wront time stamp.How i set time zone for Html.
And i want msg shouls save in 12 hrs format but it is showing 24 hrs format.

this is my latest code here is the problem i can’t save to 12 hr format it is showing 24 hr format.can you look in this code
and tell me where is the problem
objectName = txtPstFldr + “\message” + “" + fileName + "” + Now.Ticks.ToString + “.html”
Dim options As HtmlSaveOptions = SaveOptions.DefaultHtml
options.ResourceRenderingMode = True
options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader Or HtmlFormatOptions.WriteCompleteEmailAddress
msg.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(msg.Date.ToLocalTime)
message.Save(objectName, options)

@sureshkumarg

For HTML it is not possible as HtmlSaveOptions does not contain needed settings. As a workaround, you can save in MHTML first using MhtSaveOptions by setting Timezone settings and then load in MailMessage from MHTML and then save to HTML without headers(headers will be taken from MHTML). I hope this will help.

I have added a ticket with ID EMAILNET-40000 as new feature request to provide support for setting TimeZone and TimeFormat in case of HTML export as well. We will share the feedback with you as soon as the support will be included in API. For the time being, you may please try using the workaround as suggested by me.

The work arount working fine but if you provide the same in HTML it will be great.

@sureshkumarg

It’s good to hear that work around is working fine. Yes, we have considered option for providing this feature for HtmlOptions as well and will share notification with you once it will be available.

The issues you have found earlier (filed as EMAILNET-40000) have been fixed in this update.