1.Stijn
1.Stijn

Reputation: 55

Mailto is not loading the subject(or body);

I have been reading a lot of topics and trying for some time now and i can't seem to get my mailto: to fill in my subject and body.

So it starts the mail-client (i have tried 3 different clients(outlook,windows standard,gmail) and every time it fills in the mail-address but never the subject and body.

totalmenu() {
var form = document.getElementById('emailform');
// form.action = "mailto:" + personeel.email + "?subject=result&body=" 
//+ mail();
form.action = "mailto:[email protected]?Subject=result;
}

The comment shows the actual mailto i wanted to use. I made a new mailto with only a subject to check if it was object related but this is not working as well. any of u guys had similar problems or maybe see what i'm doing wrong here?

Upvotes: 0

Views: 879

Answers (1)

KIKO Software
KIKO Software

Reputation: 16688

I build my own little test code, and probably found what the problem is. This code seems to work:

<html>
<body>
<form id="emailform" method="POST">
  <input type="text" value="this is a test">
  <input type="submit" value="send email">
</form>
<script>
(function() {
  var form = document.getElementById('emailform');
  form.action = "mailto:[email protected]?Subject=result";
})();
</script>
</body>
</html>

But if I change the form method from "POST" to "GET" it doesn't work anymore.

Are you using "GET"?

I tested the code with Firefox and Chrome on Windows 10.

Upvotes: 1

Related Questions