如何在mailto的正文中传递URL

odi*_*com 14 html css mailto url

我需要在正文中发送我的网站的URL,以便邮件收件人可以点击它以加入我的网站.

但是,当前邮件客户端会像这样呈现邮件:

链接到这里http://www.example.com/foo.php?this=a

URL在&符号上被截断,因此整个加入过程失败.如何在mailto正文中传递http://www.example.com/foo.php?this=a&join=abc&user454这样的网址

我目前的HTML如下:

<a href="mailto:test@test.test?body=Link goes here http://www.example.com/foo.php?this=a&amp;really=long&amp;url=with&amp;lots=and&amp;lots=and&amp;lots=of&prameters=on_it
">Link text goes here</a>
Run Code Online (Sandbox Code Playgroud)

Mat*_* V. 23

您需要对URL进行编码.这个URL解码器/编码器工具可以解决这个问题.以下似乎有效:

<a href="mailto:test@test.test?body=Link goes here http%3A%2F%2Fwww.example.com%2Ffoo.php%3Fthis%3Da%26join%3Dabc%26user454
">Link text goes here</a>
Run Code Online (Sandbox Code Playgroud)


tek*_*agi 10

我会对您正在使用的链接进行URL编码,因此它将是:

<a href="mailto:test@test.test?body=Link%20goes%20here%20http%3A%2F%2Fwww.example.com%2Ffoo.php%3Fthis%3Da%26join%3Dabc%26user454">Link text goes here</a>
Run Code Online (Sandbox Code Playgroud)


BZ1*_*BZ1 5

你可以输入 javascript:alert(escape("YOUR URL")); 在浏览器的地址框中,获取对 mailto 链接安全的 URL。例如,在浏览器的地址框中键入以下内容,然后按 Enter。

javascript:alert(escape("http://www.example.com/foo.php?this=a"));

您将看到一个将显示的消息框。

http%3A//www.example.com/foo.php%3Fthis%3Da

基于 Opera 和 Mozilla 的浏览器允许您从警报框中复制显示的内容。

你可以通过输入来改进它

javascript:alert("mailto:MyEmailAddress@Example.com?subject=My Subject&body="+escape("http://www.example.com/foo.php?this=a"));

以便您获得链接中包含的主题和正文。其他改进可能是使用 From 名称和使用 %0a 的换行符。

javascript:alert("mailto:Just Me <CMyEmailAddress@Example.com>?subject=My Subject&body=这是链接:%250a"+escape("http://www.example.com/foo.php?this=一种”));