Google Script不以html格式发送电子邮件

时间:2014-07-01 20:51:28

标签: google-apps-script html-email

我已经设置了一个脚本,以便在将新条目提交到共享电子表格时通知用户。我正在尝试以下内容,但电子邮件将以纯文本形式发送:

function formSubmitReply(e) {
  var emailAddress = ' *email addresses* ';
  var URL = ' *URL to send as link* ';
  var message = "<HTML><BODY>"
   + "<P>" + " A new guest complaint has been entered into the database."
   + '<P>To view the spreadhseet, <A HERF="' + URL + '">click here</A>.'
   + "</HTML></BODY>";

MailApp.sendEmail(emailAddress, "New Guest Complaint", "", {htmlBody: message});
}

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

请参阅官方文档中的示例,其中使用了htmlBody参数:https://developers.google.com/apps-script/reference/mail/mail-app#sendEmail(Object) 当参数期望body html不是html页面时,你包括html和body标签。删除这些标签。另外,请注意最后的标签是相反的(/ html then / body)