我的组织正在为产品订单建立队列系统。 Google脚本应该发送自动电子邮件确认订单,但是不能正确提取电子邮件地址。不管x的值如何,“ var userEmail = e.values [x]”都返回相同的数组值。
我已经检查了所有相关变量,并确保正确安装了可安装触发器。 Google脚本会自动从onFormSubmit触发器中提取数组值。另一个组织成功地实施了相同的代码,该组织慷慨地捐赠了该代码供我们使用,但是在翻译中有些失误。
var userEmail = e.values[3];
MailApp.sendEmail(userEmail,
"unBound 3D Print #" + lastRow,
"Thanks for submitting your 3D print job. \n\nWe'll start " +
"working on it as soon as possible. You are currently " +
"number " +
(lastRow) + " in the queue. \n\nunBound Staff.",
{name:"unBound"});
据我了解,e.values应该将相应的答案返回给编号正确的形式问题。在这种情况下,e.values [0]应该返回第一个问题的答案,即用户提交的电子邮件地址。相反,输入的任何值都将返回第二个问题的答案,即用户的名字,显然这对发送电子邮件无效。
编辑: 根据要求进行记录。以下分别是值3、2和1的e.values [x]的返回。
D {"values":["1/9/2019 15:49:29","email@address.com","Last","First","Ultimaker 3","File","Orange","0","0","https://drive.google.com/open?id=1NiOj10b002CeSMg6248f2e8yCNprhIN-",""],"namedValues":{"Status":[""],"Est. Weight Grams":["0"],"Print Time (Minutes)":["0"],"Upload File (.stl please)":["https://drive.google.com/open?id=1NiOj10b002CeSMg6248f2e8yCNprhIN-"],"Preferred Printer":["Ultimaker 3"],"Color":["Orange"],"First Name":["First"],"File Name":["File"],"Last Name":["Last"],"Timestamp":["1/9/2019 15:49:29"],"Email Address":["email@address.com"]},"range":{"columnStart":1,"rowStart":2,"rowEnd":2,"columnEnd":10},"source":{},"authMode":{},"triggerUid":"299378"}
E Invalid email: First
at onFormSubmit(Code:53)
D {"values":["1/9/2019 15:50:10","email@address.com","Last","First","Ultimaker 3","File","Orange","0","0","https://drive.google.com/open?id=1GeyYfqEqJNiEYUVqqDULZs0S7H6U6kUz",""],"namedValues":{"Status":[""],"Est. Weight Grams":["0"],"Print Time (Minutes)":["0"],"Upload File (.stl please)":["https://drive.google.com/open?id=1GeyYfqEqJNiEYUVqqDULZs0S7H6U6kUz"],"Preferred Printer":["Ultimaker 3"],"Color":["Orange"],"First Name":["First"],"File Name":["File"],"Last Name":["Last"],"Timestamp":["1/9/2019 15:50:10"],"Email Address":["email@address.com"]},"range":{"columnStart":1,"rowStart":2,"rowEnd":2,"columnEnd":10},"source":{},"authMode":{},"triggerUid":"299378"}
E Invalid email: First
at onFormSubmit(Code:53)
D {"values":["1/9/2019 15:50:49","email@address.com","Last","First","Ultimaker 3","File","Orange","0","0","https://drive.google.com/open?id=10XLYK11UGuWtTppYDAyBeAU79jz5CRN8",""],"namedValues":{"Status":[""],"Est. Weight Grams":["0"],"Print Time (Minutes)":["0"],"Upload File (.stl please)":["https://drive.google.com/open?>id=10XLYK11UGuWtTppYDAyBeAU79jz5CRN8"],"Preferred Printer":["Ultimaker 3"],"Color":["Orange"],"First Name":["First"],"File Name":["File"],"Last Name":["Last"],"Timestamp":["1/9/2019 15:50:49"],"Email Address":["email@address.com"]},"range":{"columnStart":1,"rowStart":2,"rowEnd":2,"columnEnd":10},"source":{},"authMode":{},"triggerUid":"299378"}
E Invalid email: First
at onFormSubmit(Code:53)