Question

I have the following code in a standard Windows 8 Javascript Store App:

var test = document.getElementById("testButton");
test.addEventListener("click", function () {
var mailto = new Windows.Foundation.Uri("mailto:?to=my.address@here.com" + "&subject=test" + "&body=Hello,<br>How are you?");
Windows.System.Launcher.launchUriAsync(mailto);

The problem I have is that no matter what I do, I can't get a carriage return between Hello, and How are you?. I've tried \n & \r\n. What do I need to insert to get a carriage return?

Was it helpful?

Solution

Since it's a URL, you'll have to use a URL encoded character:

var mailto = new Windows.Foundation.Uri("mailto:?to=my.address@here.com" + "&subject=test" + "&body=Hello,%0dHow are you?");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top