使用Google Apps脚本设置Gmail正文的格式

时间:2018-09-27 18:42:43

标签: google-apps-script gmail

我试图找出“操作方法”的格式,该格式是通过Google Apps脚本创建和发送的Gmail正文。我已经在邮件中添加了<bold>,但是它没有加粗文本,只显示了字符<bold>

有人可以指出我所缺少的吗?

谢谢

var emailAddress = row[34];  // adminEmail column
var message = "<html><body>The " + row[9] + " event that was submitted by <bold>" + row[1] + "</bold> has not been approved yet. Please go to " + row[27] + " and review the admin notes.</body></html>";       
var subject = "An alert for " + row[1] + " needs approval"; 
MailApp.sendEmail(emailAddress, subject, message); 

1 个答案:

答案 0 :(得分:2)

尝试一下:

var emailAddress = row[34];  // adminEmail column
var message = "The " + row[9] + " event that was submitted by <b>" + row[1] + "</b> has not been approved yet. Please go to " + row[27] + " and review the admin notes.";       
var subject = "An alert for " + row[1] + " needs approval"; 
MailApp.sendEmail(emailAddress, subject, '', {
  htmlBody: message
});

使用sendEmail(recipient, subject, body, options) 您可以使用选项htmlBody输入HTML

请参阅文档here

<bold>也不起作用,并且不是有效的HTML标记,因此请改用<b></b>