javascript 如何制作带有html正文的mailto html标签 内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33036760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make a mailto html tag with html body in it The content
提问by Ashish-BeJovial
I want to make a mailto html tag with html body in it. The content I want to send is
我想制作一个带有 html 正文的 mailto html 标签。我要发送的内容是
Hello "Name"
Good Morning (in bold)
你好“名字”
早安(粗体)
How can I make this possible ?
我怎样才能做到这一点?
I tried to put <br/> <b>
etc in mailto body attribute but not worked.
我试图将<br/> <b>
etc 放在 mailto body 属性中,但没有奏效。
My body content is generated using c# code
我的正文内容是使用 c# 代码生成的
code behind
背后的代码
mailLink.InnerHtml = string.Format("<a href=\"mailto:[email protected]?Subject=Help code&body='" + System.Web.HttpUtility.HtmlEncode(result.ToString()) + "'+\"target=\"_top\">Send Mail</a>");
aspx page
aspx页面
<div id="mailLink" runat="server"></div>
回答by XP JG
As answered here: MailTo with HTML body
在这里回答:MailTo with HTML body
The standard for the mailto HTML tag to have the body was designed for a small plain text message only.
具有正文的mailto HTML 标记的标准是专为小型纯文本消息而设计的。
What would be better is to have the link activate an API or process that sent your message instead. And that could be a URL link. Like this answer: how to send email through asp.net web api
更好的是让链接激活 API 或发送您的消息的进程。这可能是一个 URL 链接。喜欢这个答案: 如何通过asp.net web api发送电子邮件
Let us know what you did to work around the issue.
请告诉我们您为解决此问题所做的工作。