2
votes

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

[email protected], [email protected], [email protected] ...

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
what does .getRemainingQuota() say?TheMaster
@TheMaster Good question. Just checked: 1381Luke
@Marios Thanks, that's great! Now I'm working on the script to split and send seperate emails. Probably going to have to post a question for that too.Luke

1 Answers

3
votes

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.

example

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.