- Home
- 製 品
- 購 入
Order Online Ordering Info Resellers - ダウンロード
- サポート
サポート依頼(英語) ライブチャット(英語) ナレッジベース(英語) Webフォーラム(英語) オンラインドキュメント(英語) FAQ(英語) チュートリアル(英語) - サービス
インストール データ移行 インテグレーション 製品カスタマイズ カスタムソフト開発 - Community Editions
- お問い合せ
Back to Tutorials list
Back to Tutorials list
Display HTML/Plain Text Message In Web Application
Since web applications run in the web browser which renders HTML, not plain-text, you should convert plain-text data into HTML to enable viewing this data in the browser. This also applies to desktop applications which render data in the HTML container.
MailBee provides you with the ability to automatically convert plain-text content into HTML during the message parsing. For the purpose of tuning the message parsing process, MailMessage class provides Parser property.
[C#]MailMessage msg = pop.DownloadEntireMessage(1); msg.Parser.PlainToHtmlMode = PlainToHtmlAutoConvert.IfNoHtml;[VB.NET]
Dim msg As MailMessage = pop.DownloadEntireMessage(1) msg.Parser.PlainToHtmlMode = PlainToHtmlAutoConvert.IfNoHtml
The ode above downloads the message from the server and tells MailBee to automatically convert the plain-text body of the message into HTML (if the message does not already have HTML version). Thus, you will get an HTML message which can be displayed in ASP.NET application as follows:
[C#]Response.Write(msg.BodyHtmlText);[VB.NET]
Response.Write(msg.BodyHtmlText)
If you also need to display message headers in HTML container, you can use HeadersAsHtml property which replaces <, >, & and " characters in all headers of the message with their HTML representation:
[C#]
msg.Parser.HeadersAsHtml = true;
Response.Write("From: " + msg.From.ToString());
[VB.NET]
msg.Parser.HeadersAsHtml = True
Response.Write("From: " + msg.From.ToString())