如何在HTML.net中将HTML标记作为纯文本邮寄?

时间:2013-12-14 09:35:25

标签: asp.net

I Have One Quiz.aspx(for online test)after Test the generated result should send as mail to Exam conductor,i store Test rresult in session("strResult"),

My Problem is when i am sending "Session("strResult").toString()" in mail,it send HTML Tag Format Like

测验结果

积分:2/2

你的能力:100%

花费的时间:0:0

测验细分:

1。总和20和30?
正确

2。减少30和20?
正确

How To send this session("strresult"),in plain text like follow

Quiz Result:
Points: 2 of 2
Your Competency: 100%

Quiz Breakdown:
1. Sum of 20 and 30?
Correct
2. Substraction Of 30 And 20?
Correct

How Should i send this in plain text format.

1 个答案:

答案 0 :(得分:0)

为邮件创建内容的示例。

 string PointsScored ="2 of 2";
 string Competency = "100%";
 string Msg = "<p>Quiz Result:</p>" +
              "<p>Points:<span style='color:red' >" + PointsScored  + "</span></p>" +
              "<p>Your Competency:<span style='color:red' >" + Competency  + "</span></p>";

现在将其添加到邮件正文中。像这样: -

 mMsg.Body = pMsg;

它将在Receiver Mail中显示如下。

Quiz Result:
Points: 2 of 2
Your Competency: 100%