我如何使用 google api 客户端检查邮件是回复邮件还是简单邮件?
How can I check mail is reply mail or simple mail using google api client?
$optParams['maxResults'] = 5;
$optParams['labelIds'] = 'INBOX';
$messages = $service->users_messages->listUsersMessages('sender@mail.com',$optParams);
$messageList = $messages->getMessages();
已获取邮件列表,如何使用此功能区分回复邮件和简单邮件?
你不能直接用 users.messages.list
获得消息列表后,您需要对每个消息 ID 执行对 users.messages.get 的调用并查看 headers。
简单邮件回复:
"headers": [
...
{
"name": "Subject",
"value": "Hello"
},
{
]
回复回复:
"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"
},
]
差异:
- 回复主题包含
Re:
- 回复包含 header
References
- 回复包含 header
In-Reply-To
$optParams['maxResults'] = 5;
$optParams['labelIds'] = 'INBOX';
$messages = $service->users_messages->listUsersMessages('sender@mail.com',$optParams);
$messageList = $messages->getMessages();
已获取邮件列表,如何使用此功能区分回复邮件和简单邮件?
你不能直接用 users.messages.list
获得消息列表后,您需要对每个消息 ID 执行对 users.messages.get 的调用并查看 headers。
简单邮件回复:
"headers": [
...
{
"name": "Subject",
"value": "Hello"
},
{
]
回复回复:
"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"
},
]
差异:
- 回复主题包含
Re:
- 回复包含 header
References
- 回复包含 header
In-Reply-To