发送邮件字符转换
//將html轉為text public string HtmlToText(string strContent) { strContent = strContent.Replace("&", "&"); strContent = strContent.Replace("''", "'"); strContent = strContent.Replace("<", " <"); strContent = strContent.Replace(">", ">"); strContent = strContent.Replace("<", "chr(60)"); strContent = strContent.Replace(">", "chr(37)"); strContent = strContent.Replace(""", "\""); strContent = strContent.Replace(";", ";"); strContent = strContent.Replace(" <br />", "\n"); strContent = strContent.Replace(" ", " "); return strContent; } //將text轉為html public string TextToHtml(string strContent) { strContent = strContent.Replace("&", "&"); strContent = strContent.Replace("'", "''"); strContent = strContent.Replace(" <", "<"); strContent = strContent.Replace(">", ">"); strContent = strContent.Replace("chr(60)", "<"); strContent = strContent.Replace("chr(37)", ">"); strContent = strContent.Replace("\"", """); strContent = strContent.Replace(";", ";"); strContent = strContent.Replace("\n", " <br/>"); strContent = strContent.Replace(" ", " "); return strContent; }
posted on 2014-07-04 14:54 strangeman 阅读(260) 评论(0) 编辑 收藏 举报