Email without date

In my use case, I should receive all emails from the user. But some emails do not have a “date” in their headers, although gmail can display the date in the web interface. So, is there any way to get this date?

Perhaps Gmail sends additional information by email?

+4
source share
1 answer

Now you can get internalDatethrough the Gmail API, which represents the time when the message was created on Google, equal to ms.

List messages:

GET https://www.googleapis.com/gmail/v1/users/me/messages?access_token={YOUR_API_KEY}

Answer:

{
 "messages": [
  {
   "id": "14ea5fa7f99dc9e6",
   "threadId": "14ea5fa7f99dc9e6"
  }, ...
}

And receive messages individually by requesting internalDate.

GET https://www.googleapis.com/gmail/v1/users/me/messages/14ea5fa7f99dc9e6?fields=internalDate&access_token={YOUR_API_KEY}

Answer:

{
 "internalDate": "1437303729000" // This is the time in ms it was created.
}

, internalDate , User.thread: get-request.

+2

All Articles