gbdavid gbdavid - 29 days ago 5
Vb.net Question

Odd <end> tag on message view Outlook 2013 Microsoft Office Interop

I'm using Microsoft.Office.Interop.Outlook, VB.net and Office 2013 to generate a MailItem, and then send the item to Outlook, show the email window and let the user edit it/send it from Outlook 2013. The main things I'm doing are:

I create the Microsoft.Office.Interop.Outlook.MailItem object and fill it with the relevant information, I generate an HTML constant for the body like this

Private Const mstrHTML_FORMAT As String = "<html><p style='font-size:10pt;font-family:Arial;'>{0}</p></html>"


Then I add the text I want to a string variable strBody and use String.Format to insert the text in the HTMLBody of my object:

objMailItem.HTMLBody = String.Format(mstrHTML_FORMAT, strBody)


I also change the format of the body to HTML:

objMailItem.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML


After a few other steps I send it to the view

objMailItem.Display(True)


My problem is, when the user sends the email, the receiver will see that the email has a message with the subject as Text

any clue of why this happens?

enter image description here

Answer Source

It's an Outlook "feature". Outlook purposely puts <end> in the message preview when the body isn't long enough to fill the preview.

It's not caused by your code or any bad HTML formatting.