简体   繁体   中英

Read gmail history starting from a specific email with php gmail api?

i want know if is possibile read just some email from INBOX and not all email.

for example

 $messages = $service->users_messages->listUsersMessages('me');
 $messages->getMessages();  

 ... PREVIUS EMAIL....
 22 oct [facebook]  id : 123
 23 oct [gmail]   id 124
 24 oct [amazon]   id 125

i check at the first time the emails and i store the last id(125) after that if i connect at gmail after 2 month i want to start from id 125 and not read all the email again. is possibile?

While doing messages.list, give labelid as "INBOX" and there is one more parameter called "q", where you can specify the query which returns messages matching this query. check this link support.google.com/mail/answer/7190?hl=en&ref_topic=3394914 to see what are all the supported operators for query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM