首页 > 解决方案 > 消息值未显示在 Outlook、html 和打字稿中

问题描述

这里的问题它没有显示消息表单的值,不知道与此代码有关。这最初是一个 javascript 代码,但我将其转换为打字稿,我想在 Outlook 中显示这些值,但它没有显示。

     The code below is for HTML file

    <div class="contact-section">
    <img src="/assets/img-01.png">
    <div class="inner-width">
        <h1>Get in touch with us</h1>
        <input type="text" class="name" placeholder="Your Name">
        <input type="email" class="email"  placeholder="Your Email">
        <textarea rows="1" placeholder="Message"  class="message"></textarea>
        <a class="btn-submit" onmouseover="appendMailTo()" id="sendMail" 
        href="mailto:random12@gmail.com?Subject=Hello%20again" >Get in
            touch </a>
    </div>

   The code below is for the ts file 

   appendMailTo(){
  let message = (document.getElementById("message") as HTMLInputElement).value;
  let subject = document.getElementById("mailSubject")
  console.log(subject);
  console.log(message);

 let mailToAttr = document.getElementById("sendMail");
 mailToAttr.setAttribute("href", "mailto:randoms12@gmail.com? 
 subject="+subject+"&body="+message);
 }

标签: htmltypescriptoutlook

解决方案


出于安全目的,Outlook 会阻止邮件正文中的任何脚本。请参阅电子邮件中是否支持 JavaScript?了解更多信息。


推荐阅读