1

The problem here it does not show the values of the message form, don't know that to do with this code. This was originally a javascript code but I converted it to typescript, I want to show the values in the outlook, but it does not show.

     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);
 }

1 Answers1

1

For security purposes, Outlook blocks any scripts in message bodies. See Is JavaScript supported in an email message? for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45