Understanding Email Quotas

3,872 views
Skip to first unread message

Steve Rohde

unread,
Jul 26, 2016, 5:17:44 PM7/26/16
to AdWords Scripts Forum
BACKGROUND
I have client who is using an MCC-level AdWords Script to email CSV files (one email per account in the MCC) to my ETL solution.  All emails are sent to the same recipient email address.


PROBLEM
The script sends emails for the first 64 accounts in the MCC but when it reaches the 65th, the script fails.  The error message in the script log is...

"Service invoked too many times for one day: email. (line 96)"    <<  Line 96 is the statement MailApp.sendEmail.


 I'm aware of the email quotas published on this support page;...

https://developers.google.com/apps-script/guides/services/quotas

...however, I'm not sure how to interpret them in order to understand why the script is hitting the quota after sending off only 64 emails. 

QUESTION 1
Does the limit of 100 Email recipients per day mean that the script can deliver emails to up to 100 different email addresses each day?   If so, then this cannot be the quota that the script is exceeding because only one recipient email address is used.


QUESTION 2
What does "excluding send" mean in the quota "feature" Email read/write (excluding send)?  Does this mean the script can send off an unlimited number of emails each day? 
 

Thanks!

Jaren Callo (AdWords Scripts Team)

unread,
Jul 26, 2016, 10:42:29 PM7/26/16
to AdWords Scripts Forum
Hi Steve,

Here's the answer to your questions:
  1. 100 recipients per day doesn't mean 100 different email address. See description on total recipients per day limit type. 
  2. MailApp does not support email read/write hence the quota does not apply in this scenario. However, there is a daily limit in sending email.
I suggest that you run the mail quota script to get an idea on how much of the daily quota are you using. 


Thanks,
Jaren P. Callo
AdWords Scripts

AussieWeb Conversion

unread,
Jul 26, 2016, 11:10:43 PM7/26/16
to AdWords Scripts Forum
Hi Steve

Question: Are there any other messages being emailed from within other MCC Scripts? Maybe account specific - not MCC level?  I'm thinking you'll find 35 of them??


Regards
Nigel

Steve Rohde

unread,
Jul 27, 2016, 1:36:53 PM7/27/16
to AdWords Scripts Forum
Hi Jaren,

Thanks for pointing out MailApp.getRemainingDailyQuota.  I included it in my script for debugging (I logged remaining quota after each email was sent). 

Before I sent any emails for the day  >>  Remaining email quota: 100

As the main script ran, the remaining quota dropped by one after each email was sent [The script iterates though all accounts in the MCC, sending off an email with a CVS attachment for each account].

After the 100th email was sent, the script failed with this message >>  Service invoked too many times for one day: email. (line 97)

So, it seems as though the script can only send 100 emails per day, even though the stated quota for Messages per day (Daily sending limit) is 2,000.

This is a problem because the MCC has 355 accounts.   


QUESTION 3
Why am I limited to 100 email messages per day, even though the stated quota for Messages per day (Daily sending limit) is 2,000? 

QUESTION 4
Can you please explain how the "sender" email address is set for the script?  It seems to be set to the email address of the last AdWords account user to perform the script authentical step after editing and saving a script.   I think I may have seen documentation about how this works but I cannot find it now.

Thanks again for your help!

-Steve

Steve Rohde

unread,
Jul 27, 2016, 2:06:21 PM7/27/16
to AdWords Scripts Forum
Hi Nigel-

There is only one script in the MCC account.  The are no scripts in the individual accounts under the MCC.

From debugging using MailApp.getRemainingDailyQuota, it seems that a script is may only send off 100 email messages per day.   This contradicts (or shows that I don't understand) the email limits published in these various pages:

Google Apps Script >> Quotas for Google Services
Google Apps Administrator Help >> Google Apps email sending limits

-Steve

AussieWeb Conversion

unread,
Jul 27, 2016, 11:40:37 PM7/27/16
to AdWords Scripts Forum
Hi Steve

As I read the table as per
Google Apps Script >> Quotas for Google Services
it's the last line I've copied here that shows the limit.

Feature

Consumer (gmail.com) Google Apps free edition (legacy) Google Apps for Work/Edu/Gov
Calendar events created      5,000 / day 10,000 / day 10,000 / day
Contacts created      1,000 / day 2,000 / day 2,000 / day
Documents created      250 / day 500 / day 1,500 / day
Email recipients per day      100* / day 100* / day 1,500* / day

On that page I also found a page detailing limits for our company specifically - I assume it has a similar link for you.
https://script.google.com/a/example-domain.com/dashboard

Thanks Jaren for the hint using MailApp.getRemainingDailyQuota,

Perhaps look into a way to amalgamate the emails you're sending into just one email.
Maybe write the output to Google docs instead and email yourself (just once) the links?

Regards
Nigel

Jaren Callo (AdWords Scripts Team)

unread,
Jul 28, 2016, 12:01:01 AM7/28/16
to AdWords Scripts Forum
Thanks Nigel!.

Hi Steve,

Since you are using MailApp, the daily limit is set to 100 recipients only. You may want to look into using Gmail API instead but take note of certain limits for free vs paid users.

Individual addresses count in every mail sent; 5 emails sent to 10 addresses count as 50 recipients*

The MailApp service allows  script to send email on user's behalf which is the email address sent to the AdWords account. However, you have the option to set the reply-to address as shown in the snippet below.

MailApp.sendEmail("reci...@example.com",
                   
"rep...@example.com",
                   
"TPS report status",
                   
"What is the status of those TPS reports?");

Thanks,
Jaren P. Callo
AdWords Scripts Team

Steve Rohde

unread,
Jul 28, 2016, 1:53:20 PM7/28/16
to AdWords Scripts Forum
Thanks Nigel,

I now understand the meaning of "Email recipients per day" limit.  But, there still something that's unclear.  It seem that the limit applies independently to each account user so that the limit is actually  "Email recipients per day per AdWords account user".

I found this out by inviting myself as a new user using a different gmail address. 

1. I tried running my script from User 1.  It exhausted my email limit, as expected.  I ran a small script with the MailApp.getRemainingDailyQuota and saw that the remaining email quota was -1.   

2. I logged as User 2.  As User 2, I ran the quota script and saw that the remaining email quota was 100!    

3. User 2 ran a modified version of my script that I knew would only send 30 emails.

4. User 2 ran the quota script and saw that the remaining email quota was now 70.  Then makes sense because 100 - 30 = 70.

5. I logged back in as User 1 and verified that my remaining email quota was still -1.  Also, I verified that if User 1 tries to run any script to send emails, that the script logs the "Service invoked too many times for one day: email " error message.

So, it seems that when a script is run manually, script consumes the email quota of the user who ran the script. 



QUESTION 5
When a script is scheduled to run automatically, which users quota is consumed?  Is it the quota of the user who last made changes to a schedule?  Is there any documentation that describes the relationship between AdWords Users and AdWords Scripts?


Thanks,
Steve

Jaren Callo (AdWords Scripts Team)

unread,
Jul 28, 2016, 10:00:49 PM7/28/16
to AdWords Scripts Forum
Hi Steve,

Based on the MailApp documentation, the service allows scripts to send email on a user's behalf. Hence, the quota of the user logged in during the script run will be consumed.

Thanks,
Jaren P. Callo
AdWords Scripts Team

Naman Jindal

unread,
Jul 29, 2016, 8:57:12 AM7/29/16
to AdWords Scripts Forum
For your Question 5:

The limit applies to user who has scheduled the script. 
Reply all
Reply to author
Forward
0 new messages