$optParams['maxResults'] = 5;
$optParams['labelIds'] = 'INBOX';
$messages = $service->users_messages->listUsersMessages('sender@mail.com',$optParams);
$messageList = $messages->getMessages();
Got list of mail how can I differentiate reply mail and simple mail using this function ?
Once you have the message list, you need to perform with each message Id a call to users.messages.get and look at the headers.
Response for simple mail:
"headers": [
...
{
"name": "Subject",
"value": "Hello"
},
{
]
Response for reply:
"headers": [
...
{
"name": "References",
"value": "\u003cCAKk+M3QBfT964eMSLRsUziugpF7uK+W7YrMv-kKE=tM4+DPxHw@mail.gmail.com\u003e"
},
{
"name": "In-Reply-To",
"value": "\u003cCAKk+M3QBfT964eMSLRsUziugpF7uK+W7YrMv-kKE=tM4+DPxHw@mail.gmail.com\u003e"
},
{
"name": "Subject",
"value": "Re: Good morning"
},
]
Differences:
Re:
References
In-Reply-To