问题
I am interested in getting the number of emails sent and received(in priority inbox) on the current day. Nothing more.
Using the REST API in Google App Script.
回答1:
GET https://www.googleapis.com/gmail/v1/users/your_email%40gmail.com/messages?labelIds=SENT&q=newer_than%3A1d&key={YOUR_API_KEY}
To get the number of messages received/sent in the last 24 hours, you can use the gmail.users.messages.list API. You must specify the following query: newer_than:1d
to only get a list of emails that were recieved/sent in the past 24 hours. You must also specify which label to query in (INBOX
or SENT
). Please refer to the following screenshot. You can test it out for yourself here.
来源:https://stackoverflow.com/questions/34377226/what-should-i-request-the-gmail-api-to-get-email-statistics