Chrome 使用GAS发送带有IF语句的表单提交电子邮件

xtfmy6hx  于 2023-09-28  发布在  Go
关注(0)|答案(1)|浏览(796)

我有一个谷歌表格,收集数据。它会输入到电子表格中我正在尝试根据提交的数据发送电子邮件。我的命名值是准确的。我有一个IF语句来查看某个属性是否为“否”。如果提交的某个领域有,那么一封电子邮件就会被发送出去。MailApp.sendEmail行出现错误:
异常:参数(number[],String,String)与MailApp.sendEmail的方法签名不匹配。在sendEmail(代码:26:13)
我不知道我有什么Map错误…

function sendEmail(e) {
  var named_values = e.namedValues;
  var name = named_values['Teacher Name'];
  var email = named_values['Teacher Email'];
  var room = named_values['Room'];
  var clco = named_values['Clean and orderly'];
  var clcod = named_values['Details1'];
  var cph = named_values['Cell phone holder'];
  var cphd = named_values['Details2'];
  var mws = named_values['20% max wall space coverage '];
  var mwsd = named_values['Details3'];
  var pwa = named_values['Proper wall adhesives used'];
  var pwad = named_values['Details4'];
  var uf = named_values['No unauthorized furniture or appliances'];
  var ufd = named_values['Details5'];
  var ard = named_values['All Required Displays'];
  var ardd = named_values['Details6'];

  if (clco == 'No')

    var msg = "Hello " + name + ",\n \nAn evaluation of your classroom, " + room + ", was performed by administration.  The following item needs to be addressed: Clean and Orderly Classroom. \n\nDetails for the item are as follows: " + clcod + " \n\nPlease rectify these issues as soon as possible."
  MailApp.sendEmail(email, "Classroom Expectations", msg)
}
kkbh8khc

kkbh8khc1#

您应该用括号括起if语句中的所有内容。您没有使用方括号,因此if的内容将只出现在语句后的第一行代码中。

相关问题