mailto 不适用于大型正文内容

2022-01-17 00:00:00 outlook javascript html html5-canvas meteor

我正在尝试使用 mailto 函数在我的 Web 应用程序中获取 Outlook 窗口,使用以下代码.

I am trying to use mailto function for getting the outlook window in my web application, using the below code.

<a href="mailto:myemail@gmail.com?body=**bodyText**">发送邮件</a>

如果 bodyText 少于 1800 个字符,它可以正常工作.但它会截断超过 1800 个字符的数据.如果正文内容超过 1800,则 Outlook 窗口仅显示 1800 个字符并截断剩余内容.

It works fine if the bodyText is less than around 1800 characters. But it truncates the data beyond 1800 characters. If the body content is more that 1800 outlook window just displays 1800 characters and truncate the remaining content.

推荐答案

首先我会参考 this 关于为什么存在 URL 长度限制.我已经尝试使用最新的 Firefox 和 Outlook 2010 进行快速测试

First I would refer to this as to why the URL length limit exists. I have tried a quick test using latest Firefox and Outlook 2010 using this

<html>
<body>
<form action="mailto:me@me.com">
<textarea name="body"></textarea>
<br/>
<input type="submit" />
</form>
</body>
</html>

在我的情况下,限制是 2061 个字符,但这将与电子邮件长度进行权衡.即使使用 POST 方法,结果对我来说也是一样的.

In my case the limit was 2061 characters, but that would be traded off against the email length. Even using POST method the result is the same for me.

由于列出的原因,链接的问题(及其最佳答案)建议不要依赖超过 2000 年的长度(截至 2016 年 4 月).

The linked question (and its top answer) advise not to rely on lengths longer than 2000 as of April 2016 for the reasons listed.

解决这个问题

我可以建议几个探索方向作为替代方案.

I can suggest a couple directions to explore as an alternative.

  1. 使用脚本调用 Outlook.我不喜欢它(兼容性、安全性),但这可能是 ActiveX 可能成为解决方案的一次.
  2. 如果目标是预览、编辑和发送电子邮件,您可以考虑编写应用程序以从服务器端发送电子邮件的草稿副本.

就我个人而言,我会探索 #2 而不是 #1.在该解决方案中,用户将收到一封包含草稿消息的电子邮件,他们可以对其进行编辑和转发,或者将其复制到新电子邮件中.这并不理想,但它可能满足您的要求.

Personally I would explore #2 over #1. In that solution the user would receive an email containing the draft message, which they can edit and forward, or copy into a new email. It's not ideal but it might do for your requirements.

相关文章