Javascript 在mailto锚标记中发送HTML

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3165839/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 03:30:38  来源:igfitidea点击:

Sending HTML in mailto anchor tag

javascripthtmlhtml-emailmailto

提问by user208662

I have an anchor tag on my web page that is currently defined as:

我的网页上有一个锚标记,当前定义为:

<a href="mailto:[email protected]?subject=Welcome&body=Check this out, please click <a href='http://example.com'>here</a>">Send to a Friend</a>

As this link demonstrates, I'm trying to send some HTML in an email when a user clicks a link. However, when the text opens in the email editor, it is displayed as pure text. How do I get it to be in HTML format?

正如此链接所示,当用户单击链接时,我试图在电子邮件中发送一些 HTML。但是,当文本在电子邮件编辑器中打开时,它显示为纯文本。我如何让它成为 HTML 格式?

回答by Tor-Erik

The body part is supposed to be text/plain according to RFC 2368

根据 RFC 2368,正文部分应该是文本/纯文本

Is it possible to add an HTML link in the body of a MAILTO link

是否可以在 MAILTO 链接的正文中添加 HTML 链接

回答by SLaks

I'm pretty sure this is impossible.

我很确定这是不可能的。

回答by Svisstack

I think is a email editor default options dependent. You telling to browser operation of open email editor then you can't say to it what method this email was send.

我认为是电子邮件编辑器的默认选项依赖。你告诉浏览器打开电子邮件编辑器的操作,然后你不能告诉它这封电子邮件是用什么方法发送的。

If you want have control with parameters like this you must implement sending mail by self.

如果你想控制这样的参数,你必须实现自己发送邮件。

回答by ChrisF

It will depend on the user's e-mail client setup.

这将取决于用户的电子邮件客户端设置。

If they've got "send e-mail in plain text" (or what ever the option is on their e-mail system) then the text will be interpreted as plain text.

如果他们有“以纯文本形式发送电子邮件”(或电子邮件系统上的任何选项),那么文本将被解释为纯文本。

If they got "send as HTML" then it should get encoded correctly.

如果他们得到“作为 HTML 发送”,那么它应该被正确编码。

You have no control over this.

你无法控制这一点。