Wednesday, 3 May 2017

Gmail API search operator "newer_than" does not work

I'm using gmail-api-sync module to access Gmail mails and retrieve all sent from Google Alerts. I'm also trying to retrieve emails newer than 1 or 2 days but it doesn't work. I tried to remove the from option and it took too long, indicating it was indeed retrieving e-mails much older than 2 days.

const options = {
  query:      'from:googlealerts-noreply@google.com',
  newer_than: '1d'
}

return new Promise((resolve, reject) => {
  gmail.queryMessages(oauth, options, (error, response) => {
     // ...
  }
  // ...
})

I fail to see what's the reason and if there are different usages than this.



via Gabriel M Fernandes

No comments:

Post a Comment