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?
Related
I want to do a search for all unique email recipients from gmail. But I'm really struggling with API. If I was interacting with a SQL database I would want something like:
SELECT DISTINCT EmailRecipient FROM MyHypotheticalGmailTable;
But I'm not sure how to translate this into a gmail API call.
I suggest you start by taking a look at the Gmail API Quickstart with Python here.
Afterwards you may want to take a look at threads.list in order to list all the threads available and then for each one use threads.get. Since there is no direct method of retrieving the unique email recipients, you will have to handle this separately from the API calls and filter the results programmatically.
Reference
Gmail API Python Quickstart;
Gmail API messages.list;
Gmail API messages.get.
I haven't been able to find any information on an API that allows to perform an email API log search on G-Suite. For security, we want to be able to have to run a search for, say, all emails originating from user#ourgsuitedomain.com and all emails coming to. While this is possible in admin.google.com, I want to know if it's possible via an API.
All I found about this is outdated threads right here on SO.
The only option to audit emails is to create an email monitor with the Email Audit API, in the case that you may want to implement ver singular search criteria, consider that the API may not fit your requirements completely. You can find the documentation at https://developers.google.com/admin-sdk/email-audit/
I'm creating my first application that requires me to update the app based on user input. I've been searching for the best way to send input to me. For example, I have a button that when the user presses I would like to send me the information they've added to a text field. Being new to this, I thought this could be done by simply sending the information to a specified email, but from what I've researched I will need some sort of database. Looking through the Apple Developer Documentation I don't even know which topic I should be looking at to figure this out, any help or direction would be very helpful!
You need to setup a server (using an API) to receive the information.
Usually you will use a webservice to receive the info from the app, although there are other ways to do that.
Sending an email through iOs would require the user to accept the email that is being sent, so doesn't look like a good idea.
Take a look at some options available to create webservices (django rest framework or flask), Google's Firebase also can be handy in this situation, since is only integrating it with your app and storing the data you want to store, with easy integration for Authentication and user tracking.
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
I'd like to monitor a users gmail account for new messages and take an appropriate action. Is there a way to fetch the history events for just new messages but NOT for things like starring an email or changing its labels, etc.?
So I ended up using messages.list and storing the timestamp of the most recent message. Then on subsequent calls to messages.list I'd supply a query of "after:theMostRecentTimestampIKnowOf" to find new messages since the last time we synced.
Another route I've seen done, is if you have the ability to add a filter (e.g. user's can do that, or use the Google Admin SDK for Google Apps users, or do it through HTML/DOM hacking) then you can simply setup a filter to apply a label to all new messages. Then just messages.list(labelId=THAT_LABEL) when you do your polling (and remove it after you process them).
There is not any ability now to filter history based on change type, though it's something that would be nice to provide at some point.