【问题标题】:Format the body text of a gmail using Google Apps Script使用 Google Apps 脚本格式化 gmail 的正文
【发布时间】:2019-03-03 17:46:17
【问题描述】:

我正在尝试找出通过 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); 

【问题讨论】:

  • 我加了&lt;html&gt;&lt;body&gt;,还是不行。

标签: google-apps-script gmail


【解决方案1】:

试试这个:

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

&lt;bold&gt;也不起作用,也不是有效的HTML标签,所以请改用&lt;b&gt;&lt;/b&gt;

【讨论】:

  • 谢谢 JSmith!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多