Error fix
Fix "Service invoked too many times for one day: email"
Service invoked too many times for one day: email
Google lists daily recipient limits of 100 for consumer accounts and 1,500 for Workspace accounts. Check the remaining quota before each send and defer the rest.
Set it up
- Wrap your sends in sendWithinQuota.
- Store anything deferred (the return value tells you how many).
- Run again the next day, or send from a Workspace account if you need more volume.
The script
/**
* Fix: "Service invoked too many times for one day: email".
* Check the remaining quota before each send and stop cleanly instead of failing mid-run.
*/
function sendWithinQuota(messages) {
var sent = 0;
for (var i = 0; i < messages.length; i++) {
if (MailApp.getRemainingDailyQuota() < 1) {
return { sent: sent, deferred: messages.length - i };
}
MailApp.sendEmail(messages[i].to, messages[i].subject, messages[i].body);
sent++;
}
return { sent: sent, deferred: 0 };
}What you should see
| sent | deferred |
|---|---|
| 100 | 37 |
The function returns what was sent and what waits. Sample values, not output from a real account.
Common errors and fixes
- How do I see what is left today
- Call MailApp.getRemainingDailyQuota() before you plan the next batch. The fix function does this before every send.
- I need more than 100 a day
- Use a Workspace account, or a bulk email service built for it.
Permissions. Running this script asks you to grant Google permissions for the services listed above, to your own script. TriggerShelf never receives your Google data. See the permissions table. Google will show "Google hasn't verified this app"; that is expected for a script you paste yourself.
TriggerShelf is independent and not affiliated with or endorsed by Google LLC. Google Sheets, Gmail, Google Drive and Apps Script are trademarks of Google LLC. Quota figures come from Google's Apps Script quotas page. Test on a copy first.