码迷,mamicode.com
首页 > 其他好文 > 详细

发送邮件字符转换

时间:2014-07-06 23:15:59      阅读:309      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   html   htm   div   

      //將html轉為text 
        public string HtmlToText(string strContent) 
        { 
            strContent = strContent.Replace("&amp", "&"); 
            strContent = strContent.Replace("‘‘", "‘"); 
            strContent = strContent.Replace("&lt", " <"); 
            strContent = strContent.Replace("&gt", ">"); 
            strContent = strContent.Replace("&lt", "chr(60)"); 
            strContent = strContent.Replace("&gt", "chr(37)"); 
            strContent = strContent.Replace("&quot", "\""); 
            strContent = strContent.Replace(";", ";"); 
            strContent = strContent.Replace(" <br />", "\n"); 
            strContent = strContent.Replace(" ", " "); 
            return strContent; 
        } 

        //將text轉為html 
        public string TextToHtml(string strContent) 
        { 
            strContent = strContent.Replace("&", "&amp"); 
            strContent = strContent.Replace("‘", "‘‘"); 
            strContent = strContent.Replace(" <", "&lt"); 
            strContent = strContent.Replace(">", "&gt"); 
            strContent = strContent.Replace("chr(60)", "&lt"); 
            strContent = strContent.Replace("chr(37)", "&gt"); 
            strContent = strContent.Replace("\"", "&quot"); 
            strContent = strContent.Replace(";", ";"); 
            strContent = strContent.Replace("\n", " <br/>"); 
            strContent = strContent.Replace(" ", " "); 
            return strContent; 

        } 

 

发送邮件字符转换,布布扣,bubuko.com

发送邮件字符转换

标签:style   blog   color   html   htm   div   

原文地址:http://www.cnblogs.com/profession/p/3824382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!