【发布时间】:2016-01-17 22:59:00
【问题描述】:
要重现该错误,请为 send_email() 创建一个 onEdit 触发器。
var ss = SpreadsheetApp.getActiveSheet();
var cell = ss.getActiveCell();
var range = SpreadsheetApp.getActiveRange();
var row = range.getRow();
var emailQuotaRemaining = MailApp.getRemainingDailyQuota();
function send_email(){
GmailApp.sendEmail('my_address@yahoo.com','Subject','Body');
ss.getRange(row,2).setValue("You have " +emailQuotaRemaining+' emails left');
}
您不会收到重复的电子邮件,但配额有时会减少 2,在极少数情况下甚至会减少 3 或 4。
连续输入1,2,3几次后,很明显递减是混乱的,一旦sendemail函数甚至没有被触发。更重要的是,我只收到了 14 封电子邮件,而不是 19 封。
对于上面的代码,工作表如下所示:
1 You have 95 emails left
2 You have 92 emails left
3 You have 94 emails left
1 You have 91 emails left
2 You have 90 emails left
3 You have 89 emails left
1 You have 89 emails left
2 You have 88 emails left
3
1 You have 86 emails left
2 You have 85 emails left
3 You have 85 emails left
1 You have 85 emails left
2 You have 85 emails left
3 You have 84 emails left
1 You have 83 emails left
2 You have 82 emails left
3 You have 80 emails left
有什么解决方法吗?
【问题讨论】:
-
您应该将此添加到 Apps 脚本问题跟踪器。 Link to Issue Tracker
-
我已经添加了。这是问题 #5674。
标签: google-apps-script gmail sendmail gmail-api