【发布时间】:2019-08-15 16:37:13
【问题描述】:
我使用下面的代码插入 HTML 文件的变量将变量作为纯文本插入,并且不在我的变量中注册代码。
function sendEmail(){
var htmlBody = HtmlService.createTemplateFromFile('emailFormat');
var variableOne = "text";
htmlBody.example = '<p>' + variableOne + '</p>';
var email_html = htmlBody.evaluate().getContent();
MailApp.sendEmail({
to: "email@email.com",
subject: "subject",
htmlBody: email_html
});
}
上面的代码使我在文件“emailFormat”中放置<?= example ?> 的任何位置变为"<p>text</p>"。问题是它没有将其显示为“文本”,而是完全显示"<p>text</p>"。如何让它显示将<p>'s 注册为代码?
【问题讨论】:
-
显示你的html代码
标签: html google-apps-script google-apps