We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Different datesent in source email and converted xps

Hi,

I convert eml message to xps. In my eml I have date sent: 10/26/2011 2:45 PM
In result xps document I got date sent: 10/26/2011 12:45PM.
I run conversion on remote box, which is in different time zone, so
I guess the dates are converted to UTC format.

Am I correct ? How can I control the process of converting date and time in email ?

Sample files are in attach.

Thanks,
Roman

Hi Roman,


Thank you for providing us the sample files.

I have tried replicating your said issue with Aspose.Email for .NET v1.3.0. Attached to my reply is the output from my test. You will notice that the attached XPS does not show the email header including the sent date. I am wondering how did you produce your XPS file. Please share the sample code if possible.

Below is my code for your reference,

C#

var message = Aspose.Email.Mail.MailMessage.Load(@“SPAM_ test (Inbox).eml”);
var printer = new Aspose.Email.Printing.MailPrinter();
printer.Print(message, “output.xps”, Aspose.Email.Printing.PrintFormat.XPS);

Hi,

Actually I use Aspose.Words for this purpose. First I convert email to mht and then to xps.

Here is my code

using (MailMessage message = MailMessage.Load(documentStream, messageFormat))
{
using (MemoryStream mhtMemoryStream = new MemoryStream())
{
// Save as MHT
message.Save(mhtMemoryStream, MailMessageSaveType.MHtmlFromat);

mhtMemoryStream.SeekToBegin();

var outStream = new MemoryStream();

// Load MHT file
var document = new Document(mhtMemoryStream);

// Accept all revisions in the document.
document.AcceptAllRevisions();

// Convert Document to defined format - ConversionFormat
document.Save(outStream, saveOption);

// set null to doucment
document = null;

return outStream;
}
}

I use this code because I need stream on output.
So, I have two questions:
1)Does Aspose.Email provide ability to convert eml, msg formats directly to xps stream
2)Does sent date is converted to UTC when converting MailMessage to mht

Thanks,
Roman

Hi Roman,


Thank you for your response and sample code.

In my initial investigation I have found that converting the message to MHTML, sets the sent date to UTC. I am still looking into it for confirmation and any possible workaround. I will keep you posted with my results on this.

Aspose.Email.Printing.MailPrinter class provides the functionality to save your XPS document to Stream object. Please check the sample code for your reference,

C#
using (var stream = new System.IO.MemoryStream())
{
var message = Aspose.Email.Mail.MailMessage.Load(“SPAM_ test (Inbox).eml”);
var printer = new Aspose.Email.Printing.MailPrinter();
printer.Print(message, stream, Aspose.Email.Printing.PrintFormat.XPS);
stream.WriteTo(new FileStream(“output.xps”, FileMode.Create));
}

Please note that the current implementation of MailPrinter class does not include the email header in the output XPS and you will not able to see the Sent Date on XPS generated with MailPrinter class. We have already logged a ticket in our tracking system to enhance this feature. If you like, I can link this thread to appropriate ticket, so you can get notified once this enhancement is available.

Regards,

Hi,

Does Aspose.Email.Printing.MailPrinter class perform in-memory conversion or it uses XPS printer installed on Windows ? Because I can use only in-memory conversion.

Yes it would be great if you link this thread to appropriate ticket.
Thanks for reply, waiting for any possible workarounds with setting Sent Date to UTC.

Regards,
Roman

Hi Roman,


Aspose.Email for .NET component does not require XPS printer to be installed on the machine where source code is expected to execute. So there is no dependency as inquired by you.

I have linked this thread to two tickets from our tracking system.

  • NETWORKNET-33109 is logged earlier to enhance the MailPrinter class to include the email headers in the resultant TIFF/XPS.
  • I have logged an investigative ticket for the issue of different “Sent Date” in result when message is converted to MHT format on a remote machine having different Time Zone. The ticket Id for your reference is NETWORKNET-33127. We will keep you posted with updates on this issue.

Regards,


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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi Roman,


I am unable to observe the issue logged under ticket NETWORKNET-33127 by using the latest version of Aspose.Email for .NET v1.4.0 (link shared by the aspose.notifies). Can you please check the same at your end and feed us back with your results.

Thank you.