Skip to content Skip to sidebar Skip to footer

Properly Populate An Email Using Only Html

For an assignment, I need to put a form in my webpage, and have the form populate an email for the user to send. I wrote up this after searching around:
POST to GET. Using the GET method will append the key/value pairs from the input fields as a query string on the mailto: link in the action attribute. This creates a URL that email clients understand how to parse:

mailto:{TARGET EMAIL ADDRESS}?subject=Subject&body=Body

<formenctype="text/plain"method="GET"action="mailto:{TARGET EMAIL ADRESS}"><inputtype="text"name="subject"value="Subject"/><inputtype="text"name="body"value="Body"/><inputtype="submit"name="submit"value="Submit"></form>

Solution 2:

mailto forms will always adds all the fields to mail body. javascript can do trick for you. are you allowed to use Javascript ..?

May be this will work for you

<html><formonsubmit="window.location='mailto:me@domain.com?subject='+myform.subject.value + '&body='+myform.comments.value"name="myform"method="post"><inputname="subject"value="Commencement Form" /><inputname="comments"value="my body" /><inputtype="submit"value="submit"></from></html>

Post a Comment for "Properly Populate An Email Using Only Html"