Throttle GmailApp sends so you don't burn the daily quota

TL;DR — A nightly email loop that dies mid-run with 'Service invoked too many times' leaves half your list emailed and no record of which half. Budget your sends, stop cleanly before the cap, and stamp a SentAt column so tomorrow's run resumes where today's stopped.

The reminder job ran fine for months. Then the list grew past a hundred rows, and one morning the Executions log says “Service invoked too many times for one day: email.” Sixty people got the email. Forty didn't. Nobody knows which forty, and if you just re-run it, the first sixty get it twice.

The fix isn't a bigger quota. It's a job that knows its budget, stops politely before the wall, and writes down what it already did.

TL;DR

  • Gmail's daily recipient cap is roughly 100 on consumer accounts and 1,500 on Workspace, shared across all your scripts
  • Count your own sends per day and refuse before you hit the cap, instead of letting GmailApp throw mid-loop
  • Add a SentAt column and stamp it right after each successful send
  • The next run skips rows with a SentAt, so it resumes cleanly
  • MailApp.getRemainingDailyQuota() tells you what Google thinks is left. Check it before a big run

Using the Apps Script editor a lot? NitroGAS drops free themes & snippets right into script.google.com — optional Co-Pilot when you want a boost.

What not to do

  • Don't wrap the send in try/catch and keep looping. Once the quota is gone, every remaining call fails, and you burn your execution time
  • Don't re-run the whole list after a failure “to be safe”. That's how people get the same email three times
  • Don't stamp SentAt before the send. A failed send then looks like a success
  • Don't set the budget exactly at the cap. Your manual tests and other scripts count too

The pattern

1. Add a SentAt column

On the sheet that drives the emails, add a SentAt column. Empty means “not sent yet”. A timestamp means “done, leave it alone”.

Email Name SentAt
ana@example.com Ana 2026-12-03 06:01
ben@example.com Ben

2. Send through a budget

The sendEmailWithBudget snippet keeps a per-day counter in Script Properties (keyed by date in the script's timezone) and returns { sent: false, reason } when the next send would go over budget:

function sendEmailWithBudget(message, opts) { opts = opts || {}; var budget = opts.dailyBudget || 90; var props = PropertiesService.getScriptProperties(); var today = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'yyyy-MM-dd'); var key = 'MAIL_SENT_' + today; var sent = Number(props.getProperty(key) || 0); if (sent + 1 > budget) return { sent: false, reason: 'Daily budget reached (' + sent + '/' + budget + ')' }; if (MailApp.getRemainingDailyQuota() < 1) return { sent: false, reason: 'Gmail quota exhausted' }; if (opts.delayMs) Utilities.sleep(opts.delayMs); MailApp.sendEmail(message); props.setProperty(key, String(sent + 1)); return { sent: true, count: sent + 1 }; }

3. Stamp after every send, stop on refusal

function sendNightlyReminders() { var sh = SpreadsheetApp.getActive().getSheetByName('Reminders'); var values = sh.getDataRange().getValues(); var head = values[0]; var col = { email: head.indexOf('Email'), name: head.indexOf('Name'), sentAt: head.indexOf('SentAt') }; var done = 0; for (var i = 1; i < values.length; i++) { var row = values[i]; if (row[col.sentAt]) continue; // already sent on an earlier run if (!row[col.email]) continue; var res = sendEmailWithBudget({ to: row[col.email], subject: 'Your weekly report is due Friday', body: 'Hi ' + row[col.name] + ',\n\nQuick reminder: the weekly report is due Friday.\n' }, { dailyBudget: 90, delayMs: 300 }); if (!res.sent) { console.log('Stopped after ' + done + ' sends: ' + res.reason); break; // tomorrow's run picks up from here } sh.getRange(i + 1, col.sentAt + 1).setValue(new Date()); done++; } console.log('Sent ' + done + ' reminders this run'); }

Writing the stamp one cell at a time is slower than a batch write, and that's on purpose here: if the script dies on row 47, rows 1–46 are already marked.

4. Let tomorrow finish the job

Put sendNightlyReminders on a daily time trigger. Day one sends 90 and stops. Day two skips those 90 and sends the rest. No duplicates, no gaps, no 6am panic.

A quick pre-flight check

Before a big one-off blast, run this once from the editor:

function checkMailQuota() { console.log('Gmail says remaining today: ' + MailApp.getRemainingDailyQuota()); }

If it says 12 and you have 400 rows, you know it will take a few days, and you can tell the client before they ask.

Why the small delay?

delayMs isn't about the daily cap. It spreads sends out so a burst of a hundred messages in a few seconds doesn't look like spam to recipients' filters, and it keeps you clear of short-term rate limits. A few hundred milliseconds is plenty. Keep an eye on the 6-minute execution limit if your list is long.

Soft NitroGAS note

NitroGAS has sendEmailWithBudget in the snippet search, so you can drop it into a project without leaving the editor. Paste your existing send loop into Co-Pilot and ask it to add the budget and the SentAt checkpoint.

Closing checklist

  • SentAt column added to the sheet that drives the emails
  • Every send goes through a daily budget set a little under your real cap
  • SentAt stamped after a successful send, never before
  • Loop breaks on { sent: false } instead of throwing
  • Daily trigger installed once so the next run resumes the list
  • Checked MailApp.getRemainingDailyQuota() before any big one-off run

Happy Coding!