MessageParserConfigHeadersAsHtml Property
Gets or sets whether the message headers should be returned as HTML.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool HeadersAsHtml { get; set; }

Property Value

Type: Boolean
true if the message headers should be returned in HTML-encoded form; false if they should be returned as-is. The default value is false.

If this property is set to true, all MailMessage properties representing the message headers (like RawHeader, To, From, Subject, etc) will return their values HTML encoded. For instance, ">" will be returned as ">".

This can be useful when printing values of MailMessage properties into HTML container (such as browser).

This property has immediate effect. There is no need to ever call Apply after changing its value.

Note Note
MessageParserConfig object cannot be used on its own. To access its members, the developer should use MailMessage.Parser property.
This sample creates a new message, sets To field and displays its value both HTML-encoded and as-is.
// To use the code below, import these namespaces at the top of your code.
using System;
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessage msg = new MailMessage();
msg.To.AsString = "John Doe <>";
Console.WriteLine("HTML Encoding off: " + msg.To.ToString());
msg.Parser.HeadersAsHtml = true;
Console.WriteLine("HTML Encoding on: " + msg.To.ToString());
See Also