我查看了许多资源以找出我的脚本出了什么问题,但没有任何效果。我正在尝试在提交 Google 表单后发送确认电子邮件。我的脚本似乎没有从表单中正确调用电子邮件地址。
我的原始脚本来自http://acrl.ala.org/techconnect/?p=2343,我为我的表单修改了它。
这是它的样子:
function swykemailconfirm(e) {
var userEmail = e.values[10]; //email from column K
var firstName = e.values[2]; //first name from column C
var lastName = e.values[1]; //last name from column B
var test = e.values[4]; //test name from column E
MailApp.sendEmail(userEmail,
"Thank you " +firstName + lastName + "for signing up to take the " + test + "Show What You Know test. " +
"Make sure you see Ms. May to get your pass. " +
"See you on Thursday in room 32 at 3:30." +
"The Math Department");
}
提交测试表单后,我收到一封包含此错误消息的电子邮件:找不到方法(类)sendEmail(字符串,字符串)。(第 6 行,文件“代码”)
在此处搜索Google 表单确认脚本以获取编辑脚本的方法后,我使用了其中一个建议并将代码更改为以下内容:
function swykemailconfirm(e) {
var userEmail = e.values["E-mail"][0];
var firstName = e.values[2];
var lastName = e.values[1];
var test = e.values[4];
MailApp.sendEmail(userEmail,
"Thank you " +firstName + lastName + "for signing up to take the " + test + "Show What You Know test. " +
"Make sure you see Ms. May to get your pass. " +
"See you on Thursday in room 32 at 3:30." +
"The Math Department");
}
提交测试表单后,我收到一封包含此错误消息的电子邮件:TypeError:无法从未定义中读取属性“0”。(第 2 行,文件“代码”)
任何帮助深表感谢!