Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<a href="#" id="thelink">Click to Email</a>
</body>
</html>
 
var customer={
name:' firstname lastname',
email: 'example@domain.com',
company: "company name",
phone_number: 'phone number',
};
var product_codes=['alpha', 'beta', 'gamma'];
quantities=[23, 56, 45];
var yourLink = document.getElementById("thelink");
yourLink.onclick = function() {
       var elf = "%0A"; //Encoded Line Feed
       mailtoBody = "Name: " + customer.name + elf
                  + "Email: " + customer.email + elf
                  + "Company Name: " + customer.company + elf
                  + "Phone Number: " + customer.phone_number + elf;
       for (var i=0; i < product_codes.length; i++) {
            mailtoBody += product_codes[i] + ": " + quantities[i] + elf;
       }
       location.href = "mailto:you@example.com?body=" + mailtoBody;
    };
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers