[英]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.