Aspose Email Sent date format

Hi!
I’m using Aspose.Email to create .eml file for viewing (not for sending) - from original data of already received mail.
How can I change “Sent” date format? I want to sign UTC (time zone) with original date. If there is any way to do this?
Thanks,
Yulia.

Hi Yulia,


Thanks for using Aspose.Email for .NET.

Please give a try to the following code to create .eml file having Sent date (from a received mail) in UTC (time zone) and let us know your feedback.


// Load received mail into MailMessage
MailMessage OriginalMsg = MailMessage.Load(“Sample.msg”);

// Create a new MailMessage object by saving information from original mail
MailMessage tempMsg = new MailMessage(
OriginalMsg.From.ToString(),
OriginalMsg.To[0].ToString(),
OriginalMsg.Subject,
OriginalMsg.Body
);

// Save UTC date from original message
tempMsg.Date = OriginalMsg.Date.ToUniversalTime();

// Display DateTime and Zone information of original mail
Console.WriteLine("Date/Time Original Mail: " + OriginalMsg.Date.ToString() + " Time Zone = " + OriginalMsg.Date.Kind.ToString());

// Display DateTime and Zone information before saving data
Console.WriteLine("Date/Time before saving: " + tempMsg.Date.ToString() + " Time Zone = " + tempMsg.Date.Kind.ToString());

// Save message as EML
tempMsg.Save(“Output.eml”,MessageFormat.Eml);

// Again load for reading information
MailMessage SavedMsg = MailMessage.Load(“Output.eml”);

// Again Display DateTime and Zone information before saving data
Console.WriteLine("Date/Time after saving: " + SavedMsg.Date.ToString() + " Time Zone = " + SavedMsg.Date.Kind.ToString());