本文介绍了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:

话虽这么说,所以在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参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 03:34
查看更多