如何确定是否发送或接收了消息(从get message端点返回)?
这是消息资源:
{
"id": string,
"threadId": string,
"labelIds": [
string
],
"snippet": string,
"historyId": unsigned long,
"internalDate": long,
"payload": {
"partId": string,
"mimeType": string,
"filename": string,
"headers": [
{
"name": string,
"value": string
}
],
"body": users.messages.attachments Resource,
"parts": [
(MessagePart)
]
},
"sizeEstimate": integer,
"raw": bytes
}
我已使用getPayload()
和标题getPayload()->getHeaders()
检查了有效负载但是没有看到任何指示是否已发送或接收消息的内容。
答案 0 :(得分:0)
您可以检查labelIds
是否有标签SENT
:
$is_sent = in_array('SENT', $message->getLabelIds());