Sending a mail from WinJS

余生长醉 提交于 2019-12-10 22:36:17

问题


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?


回答1:


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?");


来源:https://stackoverflow.com/questions/15530916/sending-a-mail-from-winjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!