JSFiddle - React, Tailwind, and code Playground

by oligray

HTML

<p>Whilst actual HTML is not possible, there are a number of configurable properties and some basic formatting available, as demonstrated here:</p>

<div id="ex"></div>

<p>Reference: <a href="http://stackoverflow.com/questions/5620324/mailto-with-html-body" target="_blank">http://stackoverflow.com/questions/5620324/mailto-with-html-body</a>

CSS

body {
    font-family: arial;
    
}

JavaScript

var formattedBody = "Dear Sir or Madam, \n\nHere are some useful documents I would like to share with you. http://www.google.co.uk";

var a = document.createElement('a');
var linkText = document.createTextNode("Create new email");
a.appendChild(linkText);
a.title = "Create new email";

var mailToLink = "mailto:[email protected]?";
var mailContent = "Subject=Documents to share&";
mailContent += "[email protected]&";
mailContent += "body=" + encodeURIComponent(formattedBody);

a.href = mailToLink + mailContent;
document.getElementById("ex").appendChild(a);