对 Outlook HTML 电子邮件的特殊字符进行编码

发布于 2024-08-27 04:00:38 字数 172 浏览 3 评论 0原文

我有一个 asp.net / C# 页面,它接受评论,然后通过电子邮件发送该评论。有时当用户输入“&”时在评论中,评论被截断。例如,如果评论是“测试和测试”,则电子邮件仅发送“测试”。

我已经尝试过 HttpUtility.HtmlEncode - 但看起来问题出在 Outlook 端,而不是 C# 端。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弄潮 2024-09-03 04:00:38

为什么不直接将电子邮件格式指定为纯文本呢?

MailMessage mail = new MailMessage();

mail.IsBodyHtml = false;

评论是如何输入的?文本框?

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 ?

客…行舟 2024-09-03 04:00:38

确保发送电子邮件的 ASP.NET 页面正确获取文本并且文本之前未被截断。如果评论的 URL 编码不正确并且页面仅接收第一部分作为参数,那么问题似乎令人惊讶。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文