Empty paragraphs in MapiMessage.BodyRtf


I’m using this code:

Dim vOutlookMsg As MapiMessage = MapiMessage.FromFile(IO.Path.GetTempPath() & pCorrID & ".msg")

vBodyRTF = vOutlookMsg.BodyRtf

But I always get after each paragraph one more paragraph as you can see in attached file Result.png. How to fix it that result would be exactly the same as in email’s body? Thank you for your response.


I am sorry I could not reproduce this at my end. Please see the attached screenshot and rtf file generated by the code below:

MapiMessage msg = MapiMessage.FromFile(“test.msg”);
richTextBox1.Rtf = msg.BodyRtf;

// save in rtf file
StreamWriter writer = new StreamWriter(“test.rtf”, false);


That is strange. I use the same code as you, but my result is different.


Hi Lina,

Could you please run the attached project at your end and check if it works. The Aspose.Network.dll file is also included in this archive. I tested it on Windows 7 64-bit. Please mention the OS (32/64 bit) and .NET framework version, in case it does not work. We will test using the similar environment and try to find out the problem.

Thank you for trying to reproduce the issue. Yes, it works fine with the attached msg file for me as well, but if I drag&drop msg from outlook in the folder, I'm getting the same issue. If I open msg file and save changes (delete attachments or modify the text), the issue disappears. I attached the file for testing but you can try with any msg from outlook. Thank you.

Were you able to reproduce empty paragraths issue?

Another issue is with font. Font is set much bigger for RichTextEditor control when message is drag&dropped from outlook into the form.

Our code is

Dim fs As System.IO.FileStream = New System.IO.FileStream(System.IO.Path.GetTempPath + args.Files(i).FileName, System.IO.FileMode.OpenOrCreate)

Dim outlookMsg As MapiMessage = MapiMessage.FromFile(System.IO.Path.GetTempPath + filename)
cRichTextEditorControl.RtfText = outlookMsg.BodyRtf

What needs to be done that fontSize for control is used the same as in email message?


I have reproduced the issue with paragraph spaces and font size using the above mentioned scenario. I have logged this bug in our issue tracking system (ID: 16970). We will notify you as soon as we make some progress to fix this. Sorry for the inconvenience.


After some more observations, we have noticed that if you prepare an email in Outlook using HTML formatting, save it as msg format in disk, load it using MapiMessage and get BodyRTF, the formatting and colors will not be saved correctly when it is displayed in RichText control or .rtf file.

But, if you prepare the email in Outlook using “Rich Text” formatting using Options --> Rich Text, all the formatting, color and paragraph lines will be displayed exactly as the original message.

This is due to the RTF Extensions format which is supported by Microsoft Outlook only. As a solution, the emails must be prepared with the Rich Text formatting.

I guess users won't be happy about using only the Rich Text formatting. Have you tested, if it happens the same by using MailMessage? What is the difference by using MailMessage and MapiMessage?


I am sorry, the Outlook message’s RTF format includes some extra formatting information, which cannot be displayed properly by Rich Text control, MS Word or WordPad. Only Outlook can display it correctly. “Rich Text” must be chosen from the options to make the formatting according to the standard RTF.

MailMessage can give you the message body in text and Html format. It is a general class for message related operations. MapiMessage is a special class for operations related to msg format only.

Hmm, using "Rich Text" I'm getting ?..? in RichText control instead of “...”

This works fine "..." but not “...”. And letters like Øø Ææ Åå are not displayed in the control, only ?? ?? ?? are shown instead.

I don't think that there is something wrong with RichText control, because if I drag&drop selected content from Outlook message, all the text including font formatting is fine.


I have reproduced this issue and logged a bug in our issue tracking system (ID: 17323). We will look into it and inform you as soon it gets fixed. Sorry for the inconvenience.


how to know by using MapiMessage or MailMessage what message body format (html or rtf) is used? MailMessage.IsBodyHtml is false in both cases.

Thank you for your answer in advance.


how to know by using MapiMessage or MailMessage what message body format (html or rtf) is used? MailMessage.IsBodyHtml is false in both cases.


We will look into it and will get back to you soon.

The issues you have found earlier (filed as 17487) have been fixed in [this update ](http://www.aspose.com/community/files/51/.net-components/aspose.network-for-.net/default.aspx).

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