Eml to msg conversion when body of the eml file is in html format

Hello,

I get Mails via Microsoft.Exchange.Data.Transport.MailItem and want store them as msg files. What I did is-

1. I send a RTF or Plain Text mail (having body and attachment both) through Microsoft Outlook and save that mail in an .eml file (RTF.eml, attached with this thread), load the .eml file through Aspose.Network.Mail.MailMessage.Load() method. After loading I used .save() method to convert that .eml file to .msg file. I am able to successfully convert the .eml file to .msg file and when I open the .msg file I could see both Body as well as attachment.

2. But when I send a HTML mail (having body and attachment both) through Microsoft Outlook and save that mail in an .eml file (HTML.eml, attached with this thread), load the .eml file through Aspose.Network.Mail.MailMessage.Load() method. After loading I used .save() method to convert that .eml file to .msg file. I am able to successfully convert the .eml file to .msg file and when I open the .msg file I could only see the attachment. There is no body at all.


Please find the attachment which consists of a testFiles.rar file which contains both .eml files. With RTF.eml file there is no problem at all and both body as well as attachment is coming properly when converted in .msg file while with HTML.eml only attachment is coming when converted in .msg format.

Any suggestions how to resolve this problem ?

Thanks

Atul

Hi Atul,

Thank you for inquiry.

The attached HTML.eml file has no body, it just has one attachment. Here is the behavior of HTML.eml file when opened with different programs:

  • Outlook Express: no attachment, no body
  • Windows Live Mail: no attachment, no body
  • Office Outlook 2010: 1 attachment, no body
  • Aspose.Network (load and save): 1 attachment, no body
I believe that both Outlook 2010 and Aspose.Network shows the same and accurate results. Could you please make sure that the HTML.eml file contains any value in body?

Thank you very much.
I got my problem solved by using Mailmessage.htmlbody property.