我有这样的变量:
var htmlBody = "<table border = '1' cellspacing='0' align = 'center'><tr><th>Job #</th><th>Task</th><th>Date</th></tr></table>”;
我尝试做的是创建一个mailto链接,以便电子邮件客户端打开以清空,主题计划和正文为htmlBody
window.location = "mailto:?subject=Schedule&body=" + htmlBody;
但是你不能在mailto链接中使用html代码,那么有什么替代我想要完成的东西吗?我不想发送电子邮件,我只想让客户端使用Subject和htmlBody打开。
还是在那里完成我想用ASP.NET MVC做的事情?我打开jquery或.NET
答案 0 :(得分:1)
要以编程方式打开电子邮件,您可以将window.location.assign与mailto:link:
一起使用window.location.assign('mailto:test@test.com');
将您的参数作为查询字符串传递:
window.location.assign('mailto:test@test.com?subject=test&body=testBody');
如下所示,无法将HTML传递到正文:MailTo with HTML body