Only sent 10 emails today, exceeded daily limit?

2019-09-11 21:04发布

问题:

I can see that the daily limit is 100. But I'm nowhere near that.

Yesterday I was sending test emails to myself via my Google Script all day and never had a problem. I must have sent like 50 in total.

Today I merely sent about 10, and now I'm blocked with the message: "Error encountered: Service invoked too many times for one day: email."

There's no problem with it looping and sending too many - it's the same logic, all I've done is fixed some spelling mistakes in the body of the email itself! And I'm only emailing myself.

回答1:

You've exceeded your quota limit. Take not of the time you started making the 50 requests plus the requests you made today. Maybe it was still under the span of 24 hours, hence you got a daily limit exceed error.

You can see the current limitations here.

Also, your error seems similar to these exceptions:

  • Service invoked too many times in a short time: Calendar. Try Utilities.sleep(1000) between calls. This indicates that the script called the given service too many times in a short period.

  • Service using too much computer time for one day. This indicates that the script exceeded the total allowable execution time for one day. It most commonly occurs for scripts that run on a trigger, which have a lower daily limit than scripts executed manually.

Try implementing Exponential Backoff:

Exponential backoff is a standard error handling strategy for network applications in which the client periodically retries a failed request over an increasing amount of time. If a high volume of requests or heavy network traffic causes the server to return errors, exponential backoff may be a good strategy for handling those errors.