发送自定义html电子邮件时的编码问题 [英] encoding problem when sending custom html emails

查看:77
本文介绍了发送自定义html电子邮件时的编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web应用程序中存在一个问题,该问题允许用户发送自定义html电子邮件.如果用户在电子邮件正文中输入报价,则将其翻译为"这样,无论谁收到电子邮件,他们的电子邮件客户端阅读器都会将其翻译为 实际报价.但我想允许用户创建自己的html,因此,如果他们在html标签中使用引号,则客户端会收到带有"标记内,而不是实际的引号内.这会阻止电子邮件正确呈现.

I have an issue in my web application which allows users to send custom html emails. If the user types a quote in the email body it is translated into " so that when whoever receives the email, their email client reader will translate it into an actual quote. But I would like to allow the users to create their own html so if they use a quote in an html tag the client receives it with a " inside the tag instead of an actual quote mark. This prevent the email from rendering correctly.

换句话说,用户创建html电子邮件:

In other words the user creates the html email:

< span样式="颜色:红色;"测试"</span>

当客户收到电子邮件时,其编码为:

when the client receives the email it is encoded as:

< span style =& quot;颜色:红色;">& quot;测试& quot;</span>

这允许单词test周围的引号在客户电子邮件阅读器中被视为实际引号,但是html标签中的引号阻止了电子邮件在客户电子邮件阅读器中显示为红色.

This allows the quotes around the word test to be viewed as actual quotes in the clients email reader but the quotes in the html tag prevent the email from displaying as red in the clients email reader.

任何有关如何解决此问题的建议将不胜感激.谢谢!

Any suggestions on how to fix this would be appreciated. thanks!

推荐答案

你好,

您是否尝试过在代码中进行更改以反映电子邮件以HTML格式发送?默认情况下,电子邮件以纯文本形式发送:

Have you tried to change it in your code to reflect the email is being sent as HTML? By default, email is sent as plain text:


__emailmessage.BodyFormat = MailFormat.Html;


这篇关于发送自定义html电子邮件时的编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆