How do you detect going over your sending quota when sending with GMail API? -


using client.discovered_api('gmail', 'v1'), i'm sending email using gmail.users.messages.send function

it sends messages fine, when quota of email exceeded, there no error.

i receive 200 ok , looks good.

"id": "15289b1d6b652c17", "threadid": "15289b1d6b652c17","labelids": ["sent"] 

but each message above quota, receive email bounce (nobody@gmail.com) telling me:

you have reached limit sending mail.

this page says should receive 429 error code, don't.

any idea go wrong? or if there way query quota?

edit: after investigations, though email nobody received telling me quota reached, original email sent anyway (meaning it's possible go on quota @ expense of receiving many nobody emails).

edit2: reported problem on api page, still didn't hear anyone. lack of response baffling.

edit 3: turns out solution broken design. there delay updating quota (can more 30 minutes... can send lot of emails in 30 min), lets send , after tells users message wasn't send after (although may have, given tests did). totally unreliable. no information in bounce figure out message rejected. when send 100 emails campaign on behalf of users, not working.

here answer after more 1 month waiting.

"i spoke gmail api engineering team, , unfortunately working intended. gmail quotas aren't computed within span of messages.send() request, rather asynchronously email enters our sending pipeline. quota state of user synchronized across system, , you'll 429 errors, there small time between when quota has run out , api has realized it. scan inbox bounce messages, that's not great workaround. in general think should assume sending email best effort , application can't assume 200 response means message sent successfully. we'll update documentation make clear."

how stupid that? i'm sending via smtp, @ least reply , user don't receive cryptic quota messages in inbox.

edit: has been updated "won't fix", updated documentation. totally retarded.

"the mail sending pipeline complex: once the user exceeds quota, there can delay of several minutes before api begins return 429 error responses. cannot assume 200 response means email sent."


Comments

Popular posts from this blog

ios - UITEXTFIELD InputView Uipicker not working in swift -

Hatching array of circles in AutoCAD using c# -