Basically am using gmail php api to show gmail inbox for my users. But the main thing is that i only want to show the gmail thread conversations of my crm contacts. For this i pass all the emails of my contacts in the q parameter of gmails threads but this the q parameter works only untill 250 emails after that i got bad request error in response. could anyone please tell is there any limit on the length of q parameter of gmail php api or a better way to handle this situation..
Because of the query length limit, you will most likely have to divide your set of emails into batches that fit within the query limit.
If performance is an issue, you can use a batch request to group the email batches into a single request. See: https://developers.google.com/gmail/api/guides/batch
Note: the requests within your batch will still be subject to rate and concurrent request limits. See: https://developers.google.com/gmail/api/v1/reference/quota
Related
I am attempting to use the Gmail API to download all the messages inside of an account. I would like to be able to allow this process to pick up where it left off in the event that it stops or has to be run again in order to find newer messages.
At first glance it looks like what I need to do is keep track of the internalDate on the messages that I am retrieving and then use that in the q variable when I call the users.messages.list endpoint. However, I am having trouble finding a way to use that when I query the API.
Does anyone know of a way to query Gmail for all messages that have an internalDate greater or less than a specific value? Or is there a better way to download all messages inside of a Gmail account?
What is the Order in which the message list returns the messages. i.e message.list api? Whether it is based on the message timestamp or any other field.
If I want to sync a very large mailbox and I fire a message.list api, then I get a pageToken for pagination, so how long is the pageToken valid? For eg if I get a page token X and I fire the api to fetch the next page after 6-7 hours will I still get the expected response.
As this pageToken validity is not mentioned in the gmail api doc, any approach on how can full mail sync be done if the service which is syncing the mailbox restarts.
If I remember correctly the order of returned emails is "newest first, to older ones". I don't believe a pageToken would expire in 6-7 hours but why would you wait for so long to get the next page? If you care about getting new emails a few hours later then you want to use the history methods, starting with startHistoryId that you get from your full load.
I'm building a messaging system for GCP-hosted platform and plan to use Gmail as a backing system. Users can write their messages through our system which will invoke Gmail API to send emails to other recipients. When someone responds, Gmail API sends a push notification and our system in turn notifies a used.
As I expect high spikes of user activity, the limitation of 1 notification per second (https://developers.google.com/gmail/api/guides/push):
Each Gmail user being watched has a maximum notification rate of 1 event/sec. Any user notifications above that rate will be dropped.
doesn't seem to work for me. But to be sure I want to understand what does it exactly mean.
In particular:
what will happen if my mailbox receive 100 emails in a second? Will Gmail generate a single notification which will include all 100 messages? Or there will be several notifications generated which will eventually notify me about all messages? Or due to high messages rate and the above-mentioned limit of 1 notification per second I will receive a single notification for the first message and the rest 99 will not be pushed to my backend?
What the documentation tells you is that, if 100 notifications appear on the same user on gmail at the same time, the first notification would come thru, then the other 99 would be dropped.
However, there is a way to recover changes by using history events, this is referred to as sync and there are multiple ways to do this. I suggest you read up on the Partial Synchronization guide.
The documentation also offers some advice on how you should architect your code to deal with this, specially in the Reliability section of the documentation.
I work on a google app engine application which currently has about 4000 users and I want to write a handler to send email to all users.
The problem is that app engine has limitations on getting entities from datastore. For example, the max number of rows which can be returned from datastore is 1000.
I can get all users incrementally by using a loop and limit, offset parameters of gql. But this time the max lifetime of a handler which is 30 seconds limits me.
I made some research to overcome this problem and I have ended up with backends. But it seems to me backends usage is different I mean it is not appropriate for this operation.
How can I achieve this task?
Thanks in advance..
from google.appengine.api import mail
mail.send_mail(sender="Example.com Support <support#example.com>",
to="Albert Johnson <Albert.Johnson#example.com>",
subject="Your account has been approved",
body="""
Dear Albert:
Your example.com account has been approved. You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
""")
Task Queues give you a 10-minute deadline. See the documentation
You can get more than 1000 items in one request. Just avoid using fetch and try this:
entities = Entity.all() # <-- no fetch
for e in entities:
mail.send_mail()
This will keep on getting users until the 10 minute limit run out: a lot of entities and more than enough for 4000 users.
My mail is regarding the option for receiving email to any address which looks like - xxx#appid.appspotmail.com documented here: http://code.google.com/appengine/docs/python/mail/receivingmail.html
My questions are:
Is there any restriction on the number of email addresses which can be created using the above format and used inside the application?
As an example I may have a million users and could have some sort of a "in-mail" facility where each user is assigned a unique "xxx" id.
Is there any limit on the number of emails which can be received by an address of the above format? I don't see any quota restrictions specified anywhere?
There's no limit to the number of email addresses you can send or receive email on. Incoming email is simply sent to your handler with the address preserved; no accounts get created, so there's no reason to limit the number of unique addresses. The system-wide quota limits on incoming mail, total requests, and calls to the mail API are the only ones that apply here.
There is no limit on the number of addresses where your app can receive mail, or the number of emails it can receive.
App Engine does not persist the addresses you've used to receive mail; each inbound message is handled like an HTTP POST and then discarded. Sending a million emails to one address or a to million addresses will use the same resources.
The mail-related quotas apply to sent mail only. For CPU, bandwidth, etc., inbound mail draws from the same resource pool as your HTTP requests. There's no indication in the docs of any quota specific to inbound mail.
I can't see any mention of a maximum of email addresses you can have in the format
string# appid.appspotmail.com. But surely there must be some internal limit specified. I guess the appspotmail option is not meant to be used to create unique emails for each of your app's users (especially if you have a large number of users).
There are limits specified in the quotas, for example you can send mails to a maximum of 7,400,000 recipients a day, and you can make a maximum of 1,700,000 calls a day to the GAE Mail API (both limits apply only when billing is enabled). So if you had a million users, you probably would reach the API limit pretty soon when most of them would receive one or multiple emails.