Free Support Forum - aspose.com

MailMessage.Load(filename) - Seems to recognize PlaintextMails as HTML Mails

We have some Mails that were sent as plaintextmails (I attached you some examples)


Now when we load the mails with MailMessage.Load(filename) then the properties of the mailsmessage IsBodyHtml and BodyType are indicating the mail were HTML !

When loading the mails with Aspose.Email.Outlook.MapiMessage.FromFile(filename) then it is correctly recognized that the mail is plaintext.


So Why Does MailMessage.Load indicate an HTML Mail ?? What should we do to avoid this ?

Hi Boas,


Thanks for writing to Aspose.Email support team.

I have searched the documents and found that its default behavior of AE that it converts MSG into EML with Html type of body content. It means that all the MSG files will always show BodyType as Html when loaded into MailMessage. You may please use MapiMessage to determine the actual body type.

For your second sample file “test.eml”, when we load it into MailMessage, it shows BodyType as Html as per the original format of eml file. If you run the following piece of code, you will observe that it shows IsBodyHtml as FALSE and BodyType as “Plain Text” which is the original body type of this newly created sample mail.

MailMessage sampleMail = new MailMessage("user01@gmail.com", "user02@gmail.com", “Subject”, “Body”);
sampleMail.Save(“SampleEml.eml”, MailMessageSaveType.EmlFormat);
MailMessage sampleLoadedMail = MailMessage.Load(“SampleEml.eml”,MessageFormat.Eml);
Console.WriteLine("sampleLoadedMail.IsBodyHtml = " + sampleLoadedMail.IsBodyHtml);
Console.WriteLine("sampleLoadedMail.BodyType = " + sampleLoadedMail.BodyType);

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