首页 > 其他 > 详细

发送邮件字符转换

时间:2014-07-06 23:15:38      阅读:433      评论:0      收藏:0      [点我收藏+]
      //將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

发送邮件字符转换

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!