如何让 google 应用程序脚本服务的剩余每日邮件配额始终如一地工作?
How do I get the remaining daily mail quota of google apps scripts service to work consistently?
我在 google 应用程序脚本上做了一个项目,以便在发送表单回复后自动发送电子邮件。但是,当我使用 MailApp.getRemainingDailyQuota()
方法检查剩余电子邮件的每日配额时,配额响应因每次脚本执行而异。
所以我创建了另一个项目来测试配额,使用 MailApp.getRemainingDailyQuota()
方法,即使如此,每次执行的配额响应也会有所不同。
用于测试的代码:
function testeDeCota() {
let cota;
cota = MailApp.getRemainingDailyQuota();
Logger.log("Cota de emails restantes: " + cota);
cota = MailApp.getRemainingDailyQuota();
Logger.log("Cota de emails restantes: " + cota);
}
我正在使用配额为 1500 的工作区帐户 emails/day。
这是我执行死刑的截图。请注意,有 3 次连续执行并且没有发送任何电子邮件,即使配额响应有所不同。回复是:
1394;
1399;
1390.
每当我尝试发送电子邮件或获取配额信息时,数字都会随机变化。
printscreen of the script executions
这似乎是有意为之的行为。
除了 Marios 提到的较早的问题 (Gmail SendEmail Quota - Decrementing Bug/issue),这是最近在 Issue Tracker 中报告的,并作为 Intended Behaviour
:
关闭
This small fluctuation in the value returned by this method is to be expected.
This behaviour is caused by how quotas are internally handled by Apps Script. It's expected behaviour.
不同的执行与循环:
有趣的是,只有在单独的调用中调用此方法时才会看到这种差异。在循环中调用此方法时,没有显示波动:
for(i=1; i<=n; i++) {
SpreadsheetApp.openById(documentID).getSheetByName(sheetName).appendRow([new Date(), MailApp.getRemainingDailyQuota()]);
Utilities.sleep(1000);
}
提交功能请求:
如所引用问题中所建议,如果这会以某种方式影响您的工作流程,您可以考虑 filing a feature request。
我在 google 应用程序脚本上做了一个项目,以便在发送表单回复后自动发送电子邮件。但是,当我使用 MailApp.getRemainingDailyQuota()
方法检查剩余电子邮件的每日配额时,配额响应因每次脚本执行而异。
所以我创建了另一个项目来测试配额,使用 MailApp.getRemainingDailyQuota()
方法,即使如此,每次执行的配额响应也会有所不同。
用于测试的代码:
function testeDeCota() {
let cota;
cota = MailApp.getRemainingDailyQuota();
Logger.log("Cota de emails restantes: " + cota);
cota = MailApp.getRemainingDailyQuota();
Logger.log("Cota de emails restantes: " + cota);
}
我正在使用配额为 1500 的工作区帐户 emails/day。
这是我执行死刑的截图。请注意,有 3 次连续执行并且没有发送任何电子邮件,即使配额响应有所不同。回复是:
1394; 1399; 1390.
每当我尝试发送电子邮件或获取配额信息时,数字都会随机变化。
printscreen of the script executions
这似乎是有意为之的行为。
除了 Marios 提到的较早的问题 (Gmail SendEmail Quota - Decrementing Bug/issue),这是最近在 Issue Tracker 中报告的,并作为 Intended Behaviour
:
This small fluctuation in the value returned by this method is to be expected.
This behaviour is caused by how quotas are internally handled by Apps Script. It's expected behaviour.
不同的执行与循环:
有趣的是,只有在单独的调用中调用此方法时才会看到这种差异。在循环中调用此方法时,没有显示波动:
for(i=1; i<=n; i++) {
SpreadsheetApp.openById(documentID).getSheetByName(sheetName).appendRow([new Date(), MailApp.getRemainingDailyQuota()]);
Utilities.sleep(1000);
}
提交功能请求:
如所引用问题中所建议,如果这会以某种方式影响您的工作流程,您可以考虑 filing a feature request。