请原谅我这里可能有“蹩脚”的问题。我到处搜寻,但未找到解决办法。
Google表单 -
我有一个表单收集两个电子邮件地址。 我需要让表单中输入的每封电子邮件在提交表单时收到“唯一”回复。
以下是我“努力”开展工作的代码示例。 (我只收到后一封电子邮件发送)
我提前感谢你的时间。
奥利弗
// this would be the first email sent to e.values[3] - the first email on the form
function formSubmitReply(e) {
var userEmail = e.values[3];
MailApp.sendEmail(
userEmail,
"Help Desk Ticket1",
"Thanks for submitting your issue. \n\nWe'll start " +
"working on it as soon as possible. \n\nHelp Desk",
{name:"Help Desk"}
);
}
// this would be the second email sent to e.values[4] - the second email on the form
function formSubmitReply(e) {
var userEmail = e.values[4];
MailApp.sendEmail(
userEmail,
"Help Desk Ticket - FYI form is sent",
"The form a has been submitted. \n\nWe need to start " +
"working on it as soon as possible. \n\nThe Reger Group",
{name:"The Reger Group"}
);
}
答案 0 :(得分:0)
这是一个盲目的镜头(尚未经过测试),但这是我的猜测:你创建了两次相同的功能,因此第二个替换了第一个。函数是唯一的,如果你只能有一个函数作为表单提交的回调,你应该调整它以在一个函数调用中做你需要的一切。
以下是您可以做的事情:
// Sends distinct messages for each recipient
function formSubmitReply(e) {
// First mail recipient and message
MailApp.sendEmail(
e.values[3],
"Help Desk Ticket1",
"Thanks for submitting your issue. \n\nWe'll start " +
"working on it as soon as possible. \n\nHelp Desk",
{name:"Help Desk"}
);
// Second mail recipient and message
MailApp.sendEmail(
e.values[4],
"Help Desk Ticket - FYI form is sent",
"The form a has been submitted. \n\nWe need to start " +
"working on it as soon as possible. \n\nThe Reger Group",
{name:"The Reger Group"}
);
}