Outlook处理mailto链接中引用的url参数 [英] Outlook handling of quoted url parameters in mailto link

查看:132
本文介绍了Outlook处理mailto链接中引用的url参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用html链接填充mailto链接的正文.目标浏览器是IE 7+,邮件客户端是Outlook 2007+.在问我问题之前,我将承认body参数用于短文本消息这一事实,如下所示:

I'm attempting to populate the body of a mailto link with an html link. The target browser is IE 7+ and mail client is Outlook 2007+. Before I ask my question, i'll acknowledge the fact that the body parameter is intended for short text messages as called out here:

https://stackoverflow.com/a/4304779/573083

,并在此处进行详细说明:

and detailed here:

特殊的"body"表示关联的是 信息. "body"字段值旨在包含以下内容: 消息的第一个文本/纯文本部分. 身体"伪 标头字段主要用于生成短文本 用于自动处理的消息(例如针对订阅"的消息 邮件列表),而不是用于一般的MIME正文.除了编码 基于UTF-8和百分比编码的字符集,无其他 编码(例如base64或quoted-printable;请参见[RFC2045])是 用于正文"字段值.因此,标题字段 与邮件编码(例如Content-Transfer-Encoding)有关 "mailto" URI不相关,必须忽略. 身体"伪 标头字段名称已为此特殊注册到IANA 目的(请参阅第8.2节).

The special "body" indicates that the associated is the body of the message. The "body" field value is intended to contain the content for the first text/plain body part of the message. The "body" pseudo header field is primarily intended for the generation of short text messages for automatic processing (such as "subscribe" messages for mailing lists), not for general MIME bodies. Except for the encoding of characters based on UTF-8 and percent-encoding, no additional encoding (such as e.g., base64 or quoted-printable; see [RFC2045]) is used for the "body" field value. As a consequence, header fields related to message encoding (e.g., Content-Transfer-Encoding) in a 'mailto' URI are irrelevant and MUST be ignored. The "body" pseudo header field name has been registered with IANA for this special purpose (see Section 8.2).

话虽这么说,所以在SO上有许多线程,通过在body标签中插入链接,其成功水平各不相同.例如: https://stackoverflow.com/a/1455881/573083 https://stackoverflow.com/a/9138245/573083

That being said, there have been a number of threads on SO with varying levels of success with inserting links in the body tag. for example: https://stackoverflow.com/a/1455881/573083 and https://stackoverflow.com/a/9138245/573083

我的问题很相似,但是特别是使用Outlook渲染引用嵌入式链接的参数.我目前有以下将要工作的东西:

My issue is similiar, but it is specifically with outlook rendering quoted parameters of embedded links. I currently have the following that is almost working:

<a href="mailto:someaddress@somedomain.com?subject=This is a subject&body=http://someserver.somedomain/somepage.aspx?id=1234%26somekey=%22somevalue%22">A link</a>

部分链接正确显示在Outlook正文中,但是Outlook在链接中不包含最终引用的url参数("somevalue"); ="somevalue"只是显示为纯文本.查看电子邮件的来源表明Outlook正在关闭封闭的<a>标记,因为它将%22解释为链接的末尾.我试图用%2f,/,'-对%22进行转义,但无济于事.我相信我需要正确的Outlook顺序来理解%22应该包含在链接中,而不是作为封闭链接的关闭.

A partial link appears correctly in the outlook body, however outlook is not including the final quoted url parameter ("somevalue") in the link; the ="somevalue" is just appearing as plain text. Viewing the source of the email message shows that outlook is closing the enclosing <a> tag as it is interpreting the %22 as the end of the link. I've attempted to escape the %22 with %2f, /, ' - to no avail. I believe that I need the correct sequence for outlook to understand that the %22 should be included in the link, and not as the closure of the enclosing link.

任何帮助将不胜感激.

推荐答案

?判断,您尚未对主体组件进行编码.

Judging by the ?, you haven't encoded the body component.

> encodeURIComponent("http://someserver.somedomain/somepage.aspx?id=1234%26somekey=%22somevalue%22") 
"http%3A%2F%2Fsomeserver.somedomain%2Fsomepage.aspx%3Fid%3D1234%2526somekey%3D%2522somevalue%2522" 

因此代码应为:

<a href="mailto:someaddress@somedomain.com?subject=This is a subject&body=http%3A%2F%2Fsomeserver.somedomain%2Fsomepage.aspx%3Fid%3D1234%2526somekey%3D%2522somevalue%2522">A link</a>

或更可能:

<a href="mailto:someaddress@somedomain.com?subject=This is a subject&body=http%3A%2F%2Fsomeserver.somedomain%2Fsomepage.aspx%3Fid%3D1234%26somekey%3D%2522somevalue%2522">A link</a>

这篇关于Outlook处理mailto链接中引用的url参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆