GmailApp.createDraft() function daily quota? - google-apps-script

I need to know if the GmailApp.createDraft() function within Apps Script will come with the daily quota for API usage, which would limit the number to 100/day? The documentation suggests that this function is not an API function, so would another hopefully higher quota apply? The email is not sent, and so I assume that creating a draft does not affect my daily send quota either. Is this correct?
My account is stuck within the 60 day waiting period before my quotas are raised to those of full Business Starter subscription, but I see no reason to believe that this would affect my creating email drafts.
I do not see any quota listed here or elsewhere on the support pages. Does anyone know where I can find an answer to this? Thanks.

createDraft(recipient, subject, body)
Creates a draft email message. The size of the email (including headers) is quota limited.
I would guess it falls under Email read/write (excluding send)
but thats just a guess i dont feel like inserting 20k drafts to test it.

Related

Gmail limits between consenting gmails

I am using a gmail account to selectively forward incoming mail to the correct recipient based on criteria in the incoming mail. Bear in mind I can't solve this using Gmail filters. I need to run Apps script in order to look up the sender in a database before deciding who to forward the mail to.
I quickly hit a "service invoked too many times" for sending Gmail, which is likely intended to prevent spam mail. However this is not spam and the recipient gmails are consenting and limits are unhelpful here.
Is there any way to remove sending limits between consenting gmails?
You're probably hitting one of the Apps Script quotas. In my experience, Google is unlikely to make exceptions or raise Apps Script limits upon request.
Most of these quotas are per-account, so a workaround that you could try is to run the script from another account once the limit is reached.
Also, the limits of the Apps Script Gmail Service are more restrictive than the limits of the pure Gmail API REST calls or other API libraries, so another workaround could be to write the script in another language and use the API, or if you want to keep using Apps Script you can use REST calls rather than the Gmail service.
Even if you still hit the quotas with the Gmail API there are ways to request a quota increase, while there is no such process for Apps Script. My guess is that Apps Script is intended for smaller projects, but if you're working with a larger volume you're supposed to use the Gmail API instead.
Quotas imposed based upon exceeding the rate not an absolute limit
It may be that you are looping to fast. Because google imposes limits based on an instantaneous rate. So assume you can send 2000 letters per day then that means you can send email every 0.023 second so it send one every 0.05 seconds you will probably stay out of trouble. By the way I don't really know what the quota is.

Service invoked too many times per day: email

I have this issue. My google account is G-Suite and I'm entitled to 1500 email recipients per day.
I have calculated the email that I have sent within a day and it adds up to only 221 recipients per day.
13 Recipients * 17 emails per day.
Is there any other issue that may caused this problem? Can it be the time between the execution runs? If so, is there any way to make a gap for each of the execution?
Are you CC'ing or BCC'ing anyone in your script? Gmail counts every CC or BCC as a separate email and thus it counts towards your email quota.
Please note the following part of the documentation:
Note: Newly created G Suite domains are subject to the consumer limit
for the first billing cycle if they have six or more users, or several
billing cycles if they have fewer users. For more information, see the
Help Center page on sending limits.
This would explain why you are temporarily limited to the Consumer quota.
Be also aware of different quota for external accounts.
As I constantly troubleshoot, I have found out that by using Google Groups, the problem went away. I believe the reason for it would be I am technically sending only one email to an address. That email address will then branch out and send to the different email that I have within that Google Group that I have created. After monitoring it for a few days, I do not have this problem anymore.
Thank you for those who have helped me.

Google Drive Email Recipient Quota

Referencing this limit: https://script.google.com/dashboard
We have a few forms through our Google Drive, and I use the FormEmailer script (placed in the script editor) to send out a summary notification to two recipients once someone fills it out.
Occasionally, we will have a meeting/gathering where a whole bunch of people will fill out these forms at once.
I did a good amount of research on this but I am getting conflicting information. Some webpages say you can't increase that limit, some say you can (how? We would be willing to pay). It's not a whole lot of extra e-mail, maybe 200 a day instead of the 100 limit.
I see this page but don't see a way to increase it: https://developers.google.com/apps-script/guides/services/quotas
Thanks!
There's no way to increase the limit for Google Apps script.
One possible work around here is to have multiple scripts that perform the same function, and send script1 to some people, and script2 to others or something similar. Alternatively if the two recipients are always the same 2 people, you can consider placing them in a group, and sending the email to the group instead, which counts as sending to only 1 person (Thus doubling your current limit).

“Pushing” Gmail to GAS — using Gmail forwarding to trigger GAS script

Summary
Is it possible to use the Gmail forwarding feature to send (i.e., “push”) via HTTP (GET/POST) to my GAS script URL? (And perhaps include its contents as a parameter?)
Goal/Background
My goal is to immediately process my incoming Gmail instead of, say, using the GAS trigger feature to query and “pull” my Gmail on a periodic basis.
The former method is relatively immediate. Whereas, the latter method creates an expected delay equal to the mean interval time between (automatically triggered) queries to my inbox.
Possible Solutions
1. Gmail Data API
This documentation states Gmail lacks a data API.
2. Atom/RSS Feeds
Atom/RSS feeds still require an aggregator to pull the data from the server and, thus, do not accomplish my goal of a push-only solution to my GAS URL to, then, in turn, trigger my script via doGet() or doPost().
3. IMAP/POP
These solutions are designed for desktop/offline processing of emails and, therefore, do not meet my goals. I need a solution that lives on the web and automates my web-based email checking tasks.
4. High-frequency GAS Trigger
A, say, 60-second trigger interval in GAS does not work because there is a cost to such high-frequency triggers in GAS due to quota limitations. i.e., I don't want to use up that much quota space on this one task because I need it for other stuff.
5. 3rd Party Listeners
I would prefer something free if possible. Someone has suggested Zapier® — which does have a free version. Do these work? Are there others?
Conclusion
Are there any creative ideas out there? Perhaps to point me in a creative direction?
I would even settle for just a way to be immediately notified (programmatically) that I received a new email.
Not possible from Google Apps Script:
Google Apps Script currently available events:
https://developers.google.com/apps-script/understanding_events
Does Gmail have a Data API?
FAQ: https://developers.google.com/gdata/faq#GmailAtomFeed
Looks like IMAP is the only option, not sure if IMAP supports callback.
A trigger can kick off a script every 60 seconds. As you stated before, this puts your average notification at 30 seconds (let's not get started on possible flaws in statistical assumptions).
Another possibility for a more immediate action is to use a service like Zapier.com as a listener. It can listen for new emails in your gmail inbox, apply filters, and initiate a GET/POST to the URL for your Apps Script (make sure it is the newest version published).
I hope this helps. Curious why you need immediate handling of the messages ...

Google script quota

I am running an online free computer science education course website. I use Google scripts to evaluate the student quizzes (I use the MCQ script). Yesterday, there was a spike in visitors to my site. I noticed that the quiz scoring script is no longer sending results to students. I checked the failure notification, and it says "Service invoked too many times for one day:"
Is it because of a quota? If there is a quota, then is there any way to increase it?
My class has more than 800 students, so it is likely that they will submit their homework on the very day I post it online. So, I badly need to increase the email quota. If there is any workaround, that will also be very useful to know.
Thanks in advance.
If you deploy the app to run as the user executing, not as you, then it will run with their quota. However, they will have to click to authorize sending mail, and it will appear to have come from their own account to themselves.
The quotas are shown on the dashboard that can be also accessed through a link in the side panel of the documentation page. I'm afraid you hit quotas for email service.
...
EDIT : Ah, didn't see Corey's answer... smart suggestion of course ;-)
Try using an external API (i.e. Mandrill). Mandrill (it's by Mailchimp, so it's pretty robust) has an easy external API with much larger limits (in the order of thousands).
You can even set the from address so that it wouldn't look spammy (or, really, any different than the normal Google Apps Script send email).
Take a look at Use Mandrill API in Google Apps Script.