我正在尝试向技术人员设置一个简单的提醒电子邮件,以提醒日常服务到期时间。我有一个2d数组和代码可以工作,但它只发送1个电子邮件,这是最低的行。 我对此有点新意,但我希望它贯穿每一行,并为每一个过期发送提醒。 任何帮助表示赞赏。
这就是我现在所拥有的:
function Email_Reminder()
{;
var sheet = SpreadsheetApp.getActiveSheet();
statusArray = sheet.getDataRange().getValues();
status = "overdue";
for (i=3;i < statusArray.length;i++){
if (status == statusArray[i][6]) {
var customer = statusArray[i][0];
}
}
var email = "djens12@gmail.com"
var subject = "Reminder";
var body = "This is a reminder that the service is overdue for " +customer+ "";
MailApp.sendEmail(email,subject,body,{NoReply : true});
}
感谢
答案 0 :(得分:0)
只需在MailApp.sendEmail()
循环
for
即可
function Email_Reminder()
{;
var sheet = SpreadsheetApp.getActiveSheet();
statusArray = sheet.getDataRange().getValues();
status = "overdue";
var email = "djens12@gmail.com"
var subject = "Reminder";
for (i=3;i < statusArray.length;i++){
if (status == statusArray[i][6]) {
var customer = statusArray[i][0];
var body = "This is a reminder that the service is overdue for " +customer+ "";
MailApp.sendEmail(email,subject,body,{NoReply : true});
}
}
}