Error when printing draft message to XPS

When using Aspose.Email 2.6.0, if you attempt to print a draft message from a PST using the MailPrinter, it is possible to get a null reference exception because the From address of the message is null.


As a workaround, you can explicitly set the From property on the message to something before printing, but we would prefer the MailPrinter to just leave this field empty if the From address is null.

Using the attached .MSG, the issue can be reproduced with this code:

var mm = MailMessage.Load(source);
var printer = new MailPrinter() { FormattingFlags = MessageFormattingFlags.MailInfo };
printer.Print(mm, dest, PrintFormat.XPS);


which throws:
System.NullReferenceException
at . .Print(MailMessage , Stream )
at . .Print(MailMessage , Stream )
at Aspose.Email.Printing.MailPrinter.Print(MailMessage message, Stream outputStream, PrintFormat printingFormat)
at Aspose.Email.Printing.MailPrinter.Print(MailMessage message, String outputFile, PrintFormat printingFormat)

Hi Barry,


Thanks for writing to Aspose.Email support team.

I have analyzed the information and have reproduced the issue here successfully. I have logged this bug in our issue tracking system as NETWORKNET-33632. You will be notified as soon as some feedback is received from developers in this regard.

Please feel free to write us back if you have any other query in this regard.

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


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