有没有办法绕过Gmail API中50个收件人的限制?



如前所述,我在获得一个简单的脚本在谷歌应用程序脚本正常工作的障碍。基本上,我需要创建一个有60个收件人的电子邮件草稿-谷歌只允许多达50个收件人到我的知识(通过使用一个应用程序脚本)。有没有任何工作围绕这在应用程序脚本?这里是配额的链接:https://developers.google.com/apps-script/guides/services/quotas。下面是我的代码,如果有帮助的话。

function doGet() {
createDraft();
return;
}
// this function grabs the correct emails from the google doc, outputs them separated by commas
function getEmails() {
const documentID = 'MY_DOCUMENT_ID';
const recipients = DocumentApp.openById(documentID).getBody().getText().split(/n/).join(',');
Logger.log(recipients);
return recipients;
}
// this creates the email draft with the list of recipients
function createDraft() {
GmailApp.createDraft(getEmails(), 'SUBJECT', 'BODY TEXT');
}

运行后收到以下消息:

错误- - - - - -异常:Limit Exceeded: Email receivers Per Message

所以我很有信心我做得对,而不是有信心有一个解决方案,但如果有人知道任何工作围绕这种类型的事情,我真的很感激!

谢谢!

Apps Script服务对某些功能有每日配额和限制,以防止滥用服务。

我可以建议两个变通方法:

  1. 打破收件人名单就像@Cooper回答的那样。使用此选项,请记住Gmail帐户每天的邮件收件人配额为100个。
  2. 将收件人添加到群组中,并将邮件发送到群组邮箱。

这个怎么样:

function getEmails() {
const documentID = 'MY_DOCUMENT_ID';
const recipients = DocumentApp.openById(documentID).getBody().getText().split(/n/);
Logger.log(recipients);
return recipients;
}
// this creates the email draft with the list of recipients
function createDraft() {
const r = getEmails();
GmailApp.createDraft(r.slice(0,50).join(','), 'SUBJECT', 'BODY TEXT');
//may need some Utilities.sleep() in here dont know
GmailApp.createDraft(r.slice(50).join(','), 'SUBJECT', 'BODY TEXT');
}

最新更新