0

I would like to create a link that opens your default email client (e.g. Gmail on your iPhone) with the following filled out:

  • TO: example@gmail.com
  • SUBJECT: Your Order
  • BODY: [A form as opposed to a text]

I know how to do the above if the Body is just a text (see below) but not if it is e.g. a HTML form.

Code if it is just a body text:

<a href="mailto:email@gmail.com?subject=Your%20Order&body=">Click here to send pre-filled email</a>

Thanks for help!

  • Possible duplicate of [Creating email link with dynamically generated body with html5 & javascript](http://stackoverflow.com/questions/9014470/creating-email-link-with-dynamically-generated-body-with-html5-javascript) – Aschab Oct 04 '16 at 03:50

1 Answers1

0

Duplicated of this

heres the code:

var link = document.getElementById('email');
link.onclick = function() {
    this.href = "mailto:you@yourdomain.com?subject=Data&body=";
    this.href += getBody();
};

function getBody() {
    return 'HelloWorld';
}
Community
  • 1
  • 1
Aschab
  • 1,378
  • 2
  • 14
  • 31