Opening winmail.dat files within a .eml message

I have an Email file (.eml). I can open that file as a MailMessage object using MailMessage.Load(string filename, FileCompatibilityMode.PreserveTnefAttachmentsFileCompatibilityMode.PreserveTnefAttachments). The MailMessage object has one attachement. The one attachement is a winmail.dat file.

I have tried to open that message using:

MapiMessage orig = MapiMessage.LoadFromTnef(fwMsg.Attachments[0].ContentStream);

However I get an error of:

System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=Aspose.Email
StackTrace:
at •.Š.Š(Stream )
at •.Š.Š(Byte[] )
at •.Š.Š()
at Aspose.Email.Mail.MailMessage.Load(Stream stream, MessageFormat format)
at Aspose.Email.Mail.MailMessage.Load(Stream stream)
at Aspose.Email.Outlook.MapiMessage.get_Headers()
at Aspose.Email.Outlook.MapiMessage.Save(Stream stream)
at Aspose.Email.Mail.TnefAttachment.‡(IEnumerable`1 )
at Aspose.Email.Mail.TnefAttachment.‡(TnefAttachment , Boolean )
at Aspose.Email.Outlook.MapiMessage.LoadFromTnef(Stream stream)System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=Aspose.Email
StackTrace:
at •.Š.Š(Stream )
at •.Š.Š(Byte[] )
at •.Š.Š()
at Aspose.Email.Mail.MailMessage.Load(Stream stream, MessageFormat format)
at Aspose.Email.Mail.MailMessage.Load(Stream stream)
at Aspose.Email.Outlook.MapiMessage.get_Headers()
at Aspose.Email.Outlook.MapiMessage.Save(Stream stream)
at Aspose.Email.Mail.TnefAttachment.‡(IEnumerable`1 )
at Aspose.Email.Mail.TnefAttachment.‡(TnefAttachment , Boolean )
at Aspose.Email.Outlook.MapiMessage.LoadFromTnef(Stream stream)

Any thoughts?

Hi Matt,


Thank you for using Aspose.Email and we are sorry for the inconvenience you have faced.

There had been instances in past where such Exceptions occurred due to different reasons depending on the source EML file. These were then fixed in the following release of Aspose.Email for .NET. We, therefore, request you to please use the latest version of Aspose.Email for .NET v2.1.0 and let us know your feedback.

If the problem still persists, we will need your source EML file to further investigate this issue and report it to our development team if it is a bug. We appreciate your cooperation in this regard and will try to assist you as soon as possible.


Thanks, I downloaded v2.1.0 and it appears that the errors I was receiving have been fixed. I was having a few other issues and they have now been addressed as well.

Thanks so much!

Matt

Hi Matt,


Thank you for the feedback.

Its good to know that your issues are resolved with the latest version of Aspose.Email for .NET which saved your time as well. If you have any further query or difficulty related to Aspose.Email, please feel free to contact us. We will try our best to help you as soon as possible.

Have a good day ahead!