title: Sending email in Javascript
body: <p>According to <a href="https://stackoverflow.com/questions/271171/sending-emails-with-javascript">Sending emails with Javascript</a>, one way to do it is the following:</p>
  <pre><code>function sendMail() {
      var link = &quot;mailto:me@example.com&quot;
               + &quot;?cc=myCCaddress@example.com&quot;
               + &quot;&amp;subject=&quot; + encodeURIComponent(&quot;This is my subject&quot;)
               + &quot;&amp;body=&quot; + encodeURIComponent(document.getElementById('myText').value)
      ;
      window.location.href = link;
  }
  </code></pre>
  <p>However I'm trying to personalize it, sending emails with variables. I did this:</p>
  <pre><code>function sendMail(subject=&quot;test&quot;, body, mail=&quot;test@gmail.com&quot;) {
    var link = `mailto:${mail}`
             + &quot;&amp;subject=&quot; + encodeURIComponent(`${subject}`)
             + &quot;&amp;body=&quot; + encodeURIComponent(`${body}`)
    ;
    window.location.href = link;
  </code></pre>
  <p>But, when sending the email, I achieve this
  fail:</p>
  <p><img src="https://i.stack.imgur.com/8vlsL.png" alt="fail (image)" /></p>
  <p>It seems like it is not recognizing each variable. How to solve it?</p>