MailBee.NET Objects 4.0

MessageParserConfig.HtmlToSimpleHtmlMode Property

Gets or sets the mode which specifies when the HTML part of the message should be converted into simple HTML (plain text converted into HTML).

public HtmlToSimpleHtmlAutoConvert HtmlToSimpleHtmlMode {get; set;}

Property Value

The mode specifying the condition which triggers automatic conversion of the HTML part of the message into simple HTML during parsing the message. The default value is Never.

Remarks

Simple HTML represenation can be useful if it's required to get plain-text version of HTML body but display this plain text in HTML container (such as browser). See HtmlToSimpleHtmlAutoConvert topic for details.

Note   MessageParserConfig object cannot be used on its own. To access its members, the developer should use MailMessage.Parser property.

Example

This sample loads the message from .EML file, converts HTML body into simple HTML format, and displays it.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
msg.Parser.HtmlToSimpleHtmlMode = HtmlToSimpleHtmlAutoConvert.IfHtml;
msg.Parser.HtmlToSimpleHtmlOptions = HtmlToSimpleHtmlConvertOptions.AddImgAltText;
Console.WriteLine(msg.BodyHtmlText);
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' The actual code (put it into a method of your class).
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
msg.Parser.HtmlToSimpleHtmlMode = HtmlToSimpleHtmlAutoConvert.IfHtml
msg.Parser.HtmlToSimpleHtmlOptions = HtmlToSimpleHtmlConvertOptions.AddImgAltText
Console.WriteLine(msg.BodyHtmlText)

See Also

MessageParserConfig Class | MailBee.Mime Namespace | HtmlToPlainMode