Reputation: 300
All the \n are removed from the string when the text is put inside mail body .
var valuess = Object.entries(feedBackText);
valuess.forEach(function (key) {
responseText = responseText.concat(' ' + key[0] + ':' + key[1] + '\n');
});
var parsedString = responseText.toString();
window.location = "mailto:[email protected]"+"?subject="+subjectmail+"&body=" +
parsedString;
Upvotes: 0
Views: 29
Reputation: 1670
The following demonstrates how you can solve this using the built-in encodeURIComponent
function:
var parsedString = "text on the" + "\n" + "next line";
var link = "mailto:[email protected]" + "?subject=Example&body=" +
encodeURIComponent(parsedString);
console.log(link);
Upvotes: 1