-2
<form action="MAILTO:myemail@example.com" method="post" enctype="text/plain">
    <input type="text" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}" required="">
    <input type="text" value="E-mail" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'E-mail';}" required="">
    <textarea type="text" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Message';}" required="">Message</textarea>
    <input type="submit" value="SEND">
</form>

The code above is in my HTML file. Once I write text in the textboxes and click the submit button it opens a new email using my email client (So far so good). But, there is not any content in the body of the email. I want to have the text I inputted to be in the body of the new email which just opened. I do not want to use any PHP or JavaScript files. I want everything to be in the HTML file.

Thanks!

johnnyRose
  • 7,310
  • 17
  • 40
  • 61
user3882752
  • 263
  • 1
  • 4
  • 14
  • 2
    You might want to check [this question](http://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-with-using-mailto) for the syntax of the `mailto:` scheme. Also, I’m a bit confused as you’re saying you don’t want to use JS, but you’re using JS in your `onfocus`/`onblur`. – max Jul 04 '15 at 22:08
  • What I meant is that I want to make the changes only in the HTML file and not add lines of code in the JS file. – user3882752 Jul 04 '15 at 22:34

1 Answers1

0

Add name=body to your text area

<textarea name='body' ... ></textarea>

Each of the other inputs can be assigned to the different lines of the email message (ie, the subject line, to line, cc, etc). All you need to do is set the "name" property of each input to the line of the email you want it to appear.

If you want your name input to be the subject of the message, add `name='subject' to your name input.

https://en.wikipedia.org/wiki/Mailto

Also, you should probably change the method to 'GET' and enforce a URI encode before the data is sent using encodeURI(value of the textarea)

Carl K
  • 974
  • 7
  • 18