Question

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 "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.

Was it helpful?

Solution

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 ?

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top