我正在生成一个 mailto:
链接,其中还包含电子邮件的正文。我正在使用 JavaScript 打开链接以启动操作系统的 mailto:
客户端。在 Chromebook 上,该链接会打开带有电子邮件地址的 Gmail,但不会打开电子邮件正文。这是链接:
var MailToLink = 'mailto:test@test.com?subject=Test%20Email%20Subject&body=Great,%20the%20mailto%20protocol%20works%20and%20you%27re%20good%20to%20go.%20Good%20luck.'
这是我用来打开链接的行:window.open(MailToLink, '_blank');
它在带有 Thunderbird 和 Gmail for Android 的 Windows 10 操作系统上运行良好。
我需要为 Chromebook 更改什么吗?
最佳答案
如何设置 location.href
而不是创建弹出窗口?
location.href = "mailto:test@test.com?subject=Test%20Email%20Subject&body=Great,%20the%20mailto%20protocol%20works%20and%20you%27re%20good%20to%20go.%20Good%20luck."
Looking for an answer drawing from credible and/or official sources.
值得一提的是,mailto 链接中的主题和正文在 RFC 2368 - The mailto URL scheme 中进行了描述。
Clients that resolve mailto URLs into mail messages should be able to correctly create RFC 822-compliant mail messages using the "subject" and "body" headers.
另请注意,关于“不安全 header ”的段落 - 所以我认为内容可能也很重要。
Unsafe headers
The user agent interpreting a mailto URL SHOULD choose not to create a message if any of the headers are considered dangerous; it may also choose to create a message with only a subset of the headers given in the URL. Only the Subject, Keywords, and Body headers are believed to be both safe and useful.
关于javascript - Mailto 链接未在 Chromebook 上复制电子邮件正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56465470/