从WinJS发送邮件

时间:2013-03-20 17:41:55

标签: javascript windows-8 winjs carriage-return

我在标准的Windows 8 Javascript商店应用程序中有以下代码:

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

我遇到的问题是,无论我做什么,我都无法在Hello,How are you?之间获得回车。我试过\n&amp; \r\n。我需要插入什么才能获得回车?

1 个答案:

答案 0 :(得分:6)

由于它是一个URL,您必须使用URL编码字符:

var mailto = new Windows.Foundation.Uri("mailto:?to=my.address@here.com" + "&subject=test" + "&body=Hello,%0dHow are you?");