Reputation: 97
I want to send email that has html tags as text
This is what I send
string sctipt = "<script src = http://whatever.com type = text/javascript></script>";
message.Body = string.Format("script:{0}", script);
the mail is send but without the string "<script src = http://whatever.com type = text/javascript></script>"
because its coming as html tag and I need it to be send as text.
Any idae anyone?
Thanks in advance
Upvotes: 1
Views: 70
Reputation: 35564
Use HtmlEncode
string script = "<script src=\"http://whatever.com\" type=\"text/javascript\"></script>";
message.Body = Server.HtmlEncode(script);
or
message.Body = System.Net.WebUtility.HtmlEncode(script);
Upvotes: 0
Reputation: 420
Three notes:
string script
instead of string sctipt
'<script src="http://whatever.com" type="text/javascript"></script>'
Upvotes: 1