MailApp not sending with large number of recipients

人盡茶涼 提交于 2021-01-28 05:03:17

问题


My code takes an input of emails that looks like this:

email1@gmail.com, email2@gmail.com, email3@gmail.com ...

and tries to send them an email using the following code.

function sendEmail(form) {
  
  var ss = SpreadsheetApp.getActive();
  var body = form.body;
  var bcc = form.bccfield;
  var cc = form.ccfield;
  var to = form.tofield;
  var subject = form.subject;
   var eHandle = ss.getSheetByName("Email Handling");
  var sig = eHandle.getRange(10, 2).getValue();
  var img = eHandle.getRange(11, 2).getValue();    
  var sigImage = '<img src ="' + img + '" >';
  
MailApp.sendEmail({
    to: to,
  cc: cc,
  bcc: bcc,
    subject: subject,
   
  htmlBody: body.replace(/\n/g, '<br>') + sig + sigImage});
  }

It seemed to always be working but now I'm trying to send to a class list of parents (about 55 at a time) and it just doesn't send anything (the code doesn't even finish). I am GSuite for Education so I should have a limit of over 1,000 recipients per day.

I'm pretty sure the only difference which now causes a problem is the number of recipients.


回答1:


You are not allowed to sent an email to more than 50 recipients at a time.

Number of recipients per email is part of Quotas for Google Services.

You are only allowed to sent an email with a maximum number of 50 recipients.

An obvious workaround would be to split the recipients into two or more (depending upon the number of recipients) different emails so this hard limitation won't be violated.



来源:https://stackoverflow.com/questions/64176235/mailapp-not-sending-with-large-number-of-recipients

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!