简体   繁体   English

onclick on button Outlook电子邮件应使用Java脚本或锚标记打开

[英]onclick on button outlook email should open using Javascript or using anchor tag

trying to use html but the email content part have variables also .. like have to display his/her contact number or registration number which I cannot hard code in email template , so if I use JavaScript and try to do with text area how can I use variables inside it ? 尝试使用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;
}

Try Anchor Tag Direct Open Outllook 试试Anchor Tag Direct Open Outllook

<a href="mailto:name1@rapidtables.com?cc=name2@rapidtables.com&bcc=name3@rapidtables.com
&amp;subject=The%20subject%20of%20the%20email
&amp;body=The%20body%20of%20the%20email">
Send mail with cc, bcc, subject and body</a>

Demo Link 演示链接

Using Javscript 使用Javscript

function Setemail(mailto,cc,bcc,subjcet,body,Title)
{
 var email='<a href="mailto:'+mailto+'?cc='+mailto+'&bcc='+bcc+'&amp;subject='+subjcet'&amp;body='+body+'">'
+Title+'</a>';
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM