Search code examples
c#htmloutlookoffice-interop

c# provide highlighted text to outlook html mail message


I am providing following HTML text to outlook :

<span style="background-color:yellow;">test</span>

I am providing this with Interop:

mailItem.To = ...;
mailItem.Subject = ...;
mailItem.HTMLBody = result.Data.Content;

However, in Outlook, I can not remove the the highlight.

enter image description here

How to format the HTML so Outlook will recognize it as a 'highlighted' text?


Solution

  • Try changing your span to:

    <span style='background:yellow;mso-highlight:yellow'>
    

    It looks like Microsoft has some specialized attributes.