尝试使用html但电子邮件内容部分也有变量..比如必须显示他/她的联系电话或注册号,我不能在电子邮件模板中硬编码,所以如果我使用JavaScript并尝试使用文本区域 我怎样才能在其中使用变量?
<textarea id="myText" style="display:none">
function sendMail(){
var link = "mailto:me@example.com"
+ "?cc=myCCaddress@example.com"
+ "&subject=" + escape("This is my subject")
+ "&body=" + escape(document.getElementById('myText').value);`
window.location.href = link;
}
答案 0 :(得分:1)
尝试使用Anchor Tag Direct Open Outllook
<a href="mailto:name1@rapidtables.com?cc=name2@rapidtables.com&bcc=name3@rapidtables.com
&subject=The%20subject%20of%20the%20email
&body=The%20body%20of%20the%20email">
Send mail with cc, bcc, subject and body</a>
使用Javscript
function Setemail(mailto,cc,bcc,subjcet,body,Title)
{
var email='<a href="mailto:'+mailto+'?cc='+mailto+'&bcc='+bcc+'&subject='+subjcet'&body='+body+'">'
+Title+'</a>';
}