3

I am new in Javascript and I would like to make a small offline tool that opens up Outlook, and presets the email in the "To" section, presets the default Subject, and presets the body of the email with text from a textarea.

I would need the text area so that I can modify the email content whenever I want.

For now, I have the following code:

<form method="post" action="mailto:yourname@yoursite.com" enctype="text/plain">
   <input type=text name=your_content>
   <input type=submit value="Submit Your Content">
</form>

However, when I submit, Outlook opens, and the name attributes' values appear before my text.

Is there a way to avoid adding the name's value in my email, replace input with textarea and add the above mentioned things?

Thanks!

Dantès Cristo
  • 183
  • 3
  • 15
  • this is not what you want? http://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-with-using-mailto – caramba Mar 02 '15 at 10:03

1 Answers1

0

Try switching the method to GET so it behaves more like an anchor tag and puts your values into url parameters instead of a post body. You will have to set the input names to valid mailto: values like body & subject

<form method="GET" action="mailto:yourname@yoursite.com" enctype="text/plain">
   <input type=text name="body">
   <input type=submit value="Submit Your Comments">
</form>

note that there is a max url size of ~2k characters

  • Thank you! It works, however, is there any chance that I might be able to replace the input (body) with a textarea? – Dantès Cristo Mar 03 '15 at 12:44
  • Try it out! `` –  Mar 03 '15 at 15:06
  • It seems that the form code above does not work for me, since I noticed it adds plus sign between the words I have there. The form practically acts as I build a link, and adds plus signs instead of white space. Is there another way I can get this done? Thanks! – Dantès Cristo Mar 03 '15 at 19:46