gpt4 book ai didi

javascript - 获得新的 Google 表单提交后,如何忽略向具有值(value)的行发送电子邮件?

转载 作者:行者123 更新时间:2023-12-04 07:20:24 31 4
gpt4 key购买 nike

我想要 功能当有人新提交他的信息时,这将使我的脚本忽略将合并电子邮件发送到我使用 Google 表单收集的以前的电子邮件。
这是我正在使用的脚本:

function sendMail() {
const emailTemp = HtmlService.createTemplateFromFile("email");
const sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("form1");
const startRow = 2
const data = sh.getRange(startRow, 2, sh.getLastRow() - 1, sh.getLastColumn() - 1).getValues();
data.forEach((row, i) => {
emailTemp.fullname = row[1];
emailTemp.phone = row[2];
let htmlMessage = emailTemp.evaluate().getContent();
let emailSent = row[6];
if (emailSent != "EMAIL_SENT") {
GmailApp.sendEmail(row[0],"Thank you!","Your email doesn't support HTML.",{ name: "Email App", htmlBody: htmlMessage });
sh.getRange(startRow + i, 6).setValue("EMAIL_SENT");
}
});
}
我想忽略所有 EMAIL_SENT 列中的值 传真 :
example
谢谢你。

最佳答案

这就是这条线的用途 if (emailSent != "EMAIL_SENT") { let emailSent = row[6];应该是这个let emailSent = row[4];根据您的原始问题,您的行从第 2 列开始。

关于javascript - 获得新的 Google 表单提交后,如何忽略向具有值(value)的行发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68548599/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com