[英]full content for mail body cannot send using <a href='mailto:{$to}?subject={$subject}&body={$body}'>
[英]how to send javascript code as body of mailto href
我想做这样的事情。
我在JS中有一个分析代码,我想通过href="mailto:?body=code&subject=code"
电子邮件”按钮将该代码作为电子邮件正文提供。
//Code
$code = "<script type='text/javascript'>
// Define the site's unique id
var _siteId = 'xxx-id-xxx' || null;
(function()
{
// create a new script element with web-seal source
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//s3.amazonaws.com/web-seal-dont-touch/webseal.js';
script.async = true;
// insert the script element into the document
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript)
})();
</script>";
我想将此部分作为正文发送,所以我使用了此功能来转换此文本。
$email_body = urlencode(htmlentities($code));
<a href="mailto:?body=<?php echo $email_body; ?>&subject=Code">Send to Developer</a>
所以我在电子邮件客户端的正文中得到了类似的东西
<
, >
我知道,我已经转换了文本,但这是因为它没有正确地接受为href mailto正文。
我想提供完美的文本作为邮件正文。
我怎么做?
所有电子邮件服务都会“扫描”电子邮件的内容,以查找恶意代码。 据我所知这是行不通的。 出于相同的原因,某些电子邮件服务还会检查电子邮件内容中的链接。
您看到的结果是因为电子邮件服务转义了字符(类似http://php.net/manual/es/function.htmlentities.php )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.