Mailto:指南和字符限制

发布于 2024-12-04 21:40:48 字数 521 浏览 0 评论 0原文

我正在尝试编写一个应用程序,该应用程序将允许用户使用 mailto 标签从 Outlook 发送电子邮件。我知道对于 mailto,涉及可以传递的字符数以及编码的限制。

有谁知道我可以使用的确切字符数,以及在编码特殊字符时应遵循哪些准则?您可以使用的最大字符数是多少?正文和主题还是包括 mailto 语法的整行?

例如,我将有以下内容:

<a href='mailto:[email protected]?subject=Test Mail&body=Line one.%0D%0ALine two.'>Test Link</a>

这将是 69 个字符吗?

忘了说了,支持的浏览器是IE6。

任何帮助将不胜感激。

谢谢

I'm trying to code an application which will allow users to send emails from outlook using the mailto tag. I know with the mailto, there involves limitation of # of characters that may be passed, as well as encoding.

Does anyone know the exact count of characters I can use, and what guidelines to follow when it comes to encoding special characters? What is counted in the max number of characters you can use? Body and Subject or the whole line including mailto syntax?

For example I will have the following:

<a href='mailto:[email protected]?subject=Test Mail&body=Line one.%0D%0ALine two.'>Test Link</a>

Would this be 69 characters??

Forgot to mention, supported browser will be IE6.

Any help would be appreciated.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

-残月青衣踏尘吟 2024-12-11 21:40:48

据我所知没有限制。

HTML 4 规范没有提及任何限制

作者可能会创建不会指向另一个文档的链接,但
而是将电子邮件发送到某个电子邮件地址。当链接是
激活后,用户代理应该导致邮件程序打开该邮件
在“收件人:”字段中包含目标电子邮件地址。

要在激活链接时发送电子邮件,请指定 MAILTO
URL 作为 href 属性的值。

http://www.w3. org/TR/WD-html40-970917/struct/links.html#h-13.2.2

但是,许多网站报告256字符限制。

您应该进行测试以确定。

您可能还会发现这个问题和答案很有启发:电子邮件主题长度限制是多少?

As far as I know there is no limit.

The HTML 4 spec says nothing about a limit

Authors may create links that do not lead to another document but
instead cause email to be sent to an email address. When the link is
activated, user agents should cause a mail program to open that
includes the destination email address in the "To:" field.

To cause email to be sent when a link is activated, specify a MAILTO
URL as the value of the href attribute.

http://www.w3.org/TR/WD-html40-970917/struct/links.html#h-13.2.2

However, many sites report a 256 character limit.

You should test to be sure.

You may also find this question and answers illuminating: What is the email subject length limit?

我为君王 2024-12-11 21:40:48

同样的问题在这里,到目前为止还没有好的结果。 IE9 的限制是每个 href="..." 大约 505 个字符,Chrome 21 更好 - 大约 2000 个字符。

更新!根据 这些人 有一个解决方法,它似乎对我有用:

 ClientScript.RegisterStartupScript(this.GetType(), "mailto", 

   "<script type = 'text/javascript'>parent.location='" + longMailtoText + 

   "'</script>") ; 

这将在客户端收到响应后启动脚本并打开 MailClient 窗口。 LongMailToText 应该遵循所有标准规则,除了长度 - 到目前为止我已经能够通过它发送超过 2000 个字符。

Same problem here, so far no good. IE9 has a limit of around 505 characters per href="...", Chrome 21 is better - around 2000 chars.

Update! According to this guys there is a workaround, and it seems to work for me:

 ClientScript.RegisterStartupScript(this.GetType(), "mailto", 

   "<script type = 'text/javascript'>parent.location='" + longMailtoText + 

   "'</script>") ; 

This will launch the script and open MailClient window as soon as client gets the response. LongMailToText should follow all standard rules, except for length - so far i was able to send over 2000 chars through it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文