Using client.discovered_api('gmail', 'v1')
, I'm sending an email using the gmail.users.messages.send
function
It sends my messages fine, but when the quota of email is exceeded, there is no error.
I receive 200 OK and it all looks good.
"id": "15289b1d6b652c17", "threadId": "15289b1d6b652c17","labelIds": ["SENT"]
But for each message above the quota, I receive an email from Bounce ([email protected]) telling me:
You have reached a limit for sending mail.
This page says that I should receive 429 error code
, but I don't.
Any idea what could go wrong? Or if there is a way to query the quota?
Edit: After investigations, even though email from nobody is received telling me quota is reached, the original email is sent anyway (meaning it's possible to go over the quota at the expense of receiving many nobody emails).
Edit2: I reported a problem on their API page, but still didn't hear anything from anyone. The lack of response is baffling.
Edit 3: Turns out their solution is just broken by design. There is a delay for updating the quota (can be more than 30 minutes... you can send a lot of emails in 30 min), so it lets you send and after tells your users that your message wasn't send after all (although it may have, given the tests I did). Totally unreliable. No information in the bounce to figure out what message was actually rejected. When you send 100 emails campaign on behalf of users, this is just not working.
Increase the quota for an APIUnder Project, select the project you're using for the migration. Quotas. Using the checkboxes, select one or more quotas to edit, then click Edit Quotas.
How can I send more than 500 emails a day on Gmail? Two of the easiest ways to bypass the 500 daily emails limit on Gmail include: Creating a different account to send emails to additional recipients. Creating Google Groups to send messages to a large group of individuals.
Here is the answer after more than 1 month waiting.
"I spoke with the Gmail API engineering team, and unfortunately this is working as intended. Gmail quotas aren't computed within the span of the Messages.send() request, but rather asynchronously as the email enters our sending pipeline. The quota state of the user will be synchronized across the system, and you'll get 429 errors, but there is a small time between when the quota has run out and the API has realized it. You could scan the inbox for bounce messages, but that's not a great workaround. In general I think you should assume that sending email is best effort and that your application can't assume that a 200 response means the message was sent successfully. We'll update the documentation to make this clear."
How stupid is that? I'm back to sending via SMTP, at least you get the reply immediately and user don't receive cryptic quota messages in their inbox.
EDIT: This has been updated to "won't fix", they only updated the documentation. Totally retarded.
"The mail sending pipeline is complex: once the the user exceeds their quota, there can be a delay of several minutes before the API begins to return 429 error responses. So you cannot assume that a 200 response means the email was successfully sent."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With