Gmail API发送或接收邮件

时间:2018-02-04 01:45:33

标签: php json laravel gmail-api

如何确定是否发送或接收了消息(从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()检查了有效负载但是没有看到任何指示是否已发送或接收消息的内容。

1 个答案:

答案 0 :(得分:0)

您可以检查labelIds是否有标签SENT

$is_sent = in_array('SENT', $message->getLabelIds());