开发者

Encoding Special Characters For Outlook HTML Email

开发者 https://www.devze.com 2022-12-24 18:09 出处:网络
I have an asp.net / C# page which takes a comment, and then emails that comment. Sometimes when the user enters \"&\" in the comment, the comment is being truncated. So for example if the comment

I have an asp.net / C# page which takes a comment, and then emails that comment. Sometimes when the user enters "&" in the comment, the comment is being truncated. So for example if the comment is "开发者_JAVA技巧test & test" the email only sends out "test ".

I have tried HttpUtility.HtmlEncode - but it looks like the issue is on the outlook side and not on the C# side.


Why not just specify the email format to be plain text?

MailMessage mail = new MailMessage();

mail.IsBodyHtml = false;

How is the comment being entered? TextBox ?


Make sure that the ASP.NET page that is sending the email gets the text correctly and it is not truncated before. The issue seems surprisingly like if the comment is not URL encoded correctly and the page receives only the first part as a parameter.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号