How to fix the quota problem of email wotj G Suite account? - email

I have some a script with trigger set up to send emails daily with GSuite account (about 10 triggers to send about 15 email in total per day, average 6 recipients/email.
However, last few days, I got the alert:
Exception: Service invoked too many times for one day: email
when running the script by trigger or by manually.
I do not think I hit the quota of sending email daily of Google. This morning, when I check the quota remaining by function MailApp.getRemainingDailyQuota(), I only get 4 email remaining. I do not know what happened.
Is there anyone could please help me to solve this problem?
This is the alert I receive:
Your script, AutomaticSendingEmail, has recently failed to finish
successfully. A summary of the failure(s) is shown below. To configure
the triggers for this script, or change your setting for receiving
future failure notifications, click here.
Start Function Error Message Trigger End
6/13/20 3:59 PM send_overtimerequest_email Exception: Service invoked too many times for one day: email. time-based 6/13/20 3:59 PM
Sincerely,

Looking at the page for Apps Script quotas it does specify that the limitations per day is counting recipient (100 recipient/day), so in this case you have no much option. Make sure that you are using the correct account because the limitation for G Suite accounts are 1500 recipient/day. Also check out if this may be applying to you right now:
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.
A workaround that I would suggest is to have a service account and use Domain Wide Delegation to impersonate and user then make use of the Gmal API

Related

SendGrid Email Activity API rate limit

In testing code that uses the SendGrid Email Activity API, I have received "too many messages" errors. I have examined the "rate limit" response headers and it appears that I am being limited to 10 requests per 5 minute block in the day. That is, the first 5 minutes of every hour can have 10 requests, the next 5 minutes can have 10 requests, etc.
I asked SendGrid support about this. The first response was pretty generic, but seems to indicate that the threshold is correct and says I really should be using webhooks to get the status. I haven't found anything in the documentation saying this and I haven't seen anything the specifies what the rate limits are.
For those of you using the Email Activity API, are you limited to 10 requests per 5 minutes? If yes, what do you do with the API?
Here's an snippet of what I ended up using with requests, tenacity and ratelimit:
from ratelimit import limits, sleep_and_retry
import requests
import tenacity
#sleep_and_retry
#limits(calls=2, period=60)
#tenacity.retry(
retry=tenacity.retry_if_exception_type(requests.exceptions.HTTPError),
stop=tenacity.stop_after_attempt(10),
wait=tenacity.wait.wait_fixed(60),
)
def _call_api(headers, params):
response = requests.get(
"https://api.sendgrid.com/v3/messages",
json={},
headers={},
params={},
)
try:
response.raise_for_status()
except requests.exceptions.HTTPError:
logger.info(f"Request failed {response.headers}, retrying in 1 minute")
raise
return response
I received a response from SendGrid support that says:
Your findings are correct in that we do limit this endpoint to 10 requests per 5 minutes. This is a hard limit that we do not have the means of raising. The Email Activity Feed as well as the Email Activity API endpoint are meant for troubleshooting specific issues and attaining detailed message metadata.
I previously found the rate limit to be 10/5min but it appears that SendGrid have changed the rate limit to 2 requests every 60 seconds sometime in the past week. Can anyone confirm this?
I'm using the webhook to report non-delivery back to my application but I also need to use the activity API to resolve async bounce notifications. Async bounces are when a destination mail server accepts a message during the smtp session but subsequently sends a bounce notification email. When this occurs, SendGrid do not provide the detail of the bounced message in the webhook and the message is incorrectly reported as delivered in the SendGrid app. When asked, they respond that there's nothing they can do about it, even though I have explained to them how I use their activity api to resolve this.
I pay extra to use the activity API to fix a problem that they should address themselves, so I'm very frustrated that they apply such restrictive rate limits, then change them without notice.

How are Google Apps Script mail quotas calculated?

The Current Quotas table on the Quotas for Google Services page shows a feature called "Email read/write (excluding send)," which is limited to 50,000 / day for G Suite Business customers.
I have several Google Apps Scripts that use MailApp to send emails, and today users of my scripts started getting the error: "Service invoked too many times for one day: email"
When I ran MailApp.getRemainingDailyQuota() it showed -1, confirming that the quota had been exceeded.
When I checked Google Vault to see how many messages my account had sent between yesterday and today, it showed about 3,294.
When I reached out to G Suite Support to ask about this, they directed me to the G Suite Admin Email sending limits page, which shows that G Suite accounts are limited to sending 2,000 messages per rolling 24-hour period.
3,294 is greater than 2,000, but both are well below 50,000, so I'm wondering what actually counts against the 50,000 quota.
What mail-related operation does "read/write" pertain to?
We also use gsuite and Google script to send lots of mails. And also have lots of questions about quotas. The results of my observation is that limits applied with some lag. I can send over limit mails (some amount), before limitation will apply. Amount is vary and bit unpredictable, but almost always if I do sime pause before sending over limit mails - I got quota errors :(
I can't comment, thats why updating answer. Just try to add few mails into bcc :) and check metrics

When will my Google Apps Script email recipients per day limit increase?

I am a G Suite user using Google Apps Scripts to trigger emails. This link says that I can email 1500 recipients per day but that...
"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".
This means I can only send 100 emails per day, which I am nearing.
I want to know how many billing cycles I have to wait for until my send limit will increase. I am the only user of the G Suite domain and the vagueness in the above quote isn't helping me. If anyone knows the answer and/or can suggest a solution to increasing the send limit now or a clever solution to cope whilst the limit is at it's current level, that would be greatly appreciated. Thanks

Why is my mails staying in “backlog” of Mandrill?

at previous hour we reached the number of maximum limit of sending emails per hour which is not surprising since we know our limit per hour to send. However, after an hour passed I assumed that the rest of the emails will be sent automatically. It did not work that way. Now I have over 800 per hour to send and I sent 0 in this hour, at the same time, I see that 139 emails are backlogged from previous hour. Could you please help me how can I send those?
For everyone with a new account (and not over the hourly threshold) and still getting this problem, Mandrill can sometimes wrongly think your account is sending suspicious activity.
To check if this is the case go to the mandrill dashboard and in the bottom left click support. There should be an alert informing you to complete an account review.
You'll want to reach out to Mandrill support so they can look at your specific account. There's not enough information here about the API calls you're making or your account to be able to say what's happening.
It should be something related to your api if you are using api to send. Otherwise mandrill sends them right away as soon as you reach to next hour!
If you have just signed up for madrill then it usually takes longer time to prove your genuinity.
I suggest you to send a email with your details to help#mandrill.com and they will resolve it Max. 3 working days!
I did the same and they reverted within 30 hours and my mails are a breeze now!

What happens after you reach the Salesforce daily Email limit?

In Salesforce you can set up various workflow processes or build API apps that send email. For most standard Salesforce orgs, there is a limit of 1000 emails per day. (e.g. see here)
I can't find any info on what happens after you reach the limit.
e.g. what sort of errors occur, and are administrators automatically notified?
It'll throw an exception (I can't remember the exact message). I've gotten these from time to time and I think they can't be caught. A quick way to check would be create an anonymous block with an isFuture method that sends 10 emails inside of a loop. Call this isFuture method inside of another loop (also 10x) and you'll send 100 emails without hitting governor limits.
Of course you'll have to run your code 11x to get the email exception. This is a pretty shite way to do it, but it's better than clicking a button 1000x.