[英]How to “Mark as Read” an Email in Gmail using Gmail API?
I have used Gmail API for reading Mails and it's working fine. 我使用Gmail API来阅读邮件,它运行正常。 I was successfully able to do that.
我成功地做到了。 But as I want that particular email as "Mark as Read" ( Note : "Mark as Read" not apply the label here) whenever I read that email through Gmail API, I was unable to do so.
但是,当我想通过Gmail API读取该电子邮件时,我希望该特定电子邮件为“标记为已阅读”( 注意 :“标记为已阅读”不在此处应用标签),我无法这样做。 Actually, I didn't find any method to do so through Gmail API.
实际上,我没有通过Gmail API找到任何方法。 Is there any way to do so?
有没有办法这样做?
PS: I'm using PHP for this process. PS:我正在使用PHP进行此过程。
You have to modify the message, and remove the UNREAD
label. 您必须修改消息,并删除
UNREAD
标签。
POST https://www.googleapis.com/gmail/v1/users/me/messages/{MESSAGE_ID}/modify?access_token={ACCESS_TOKEN}
{
"removeLabelIds": [
"UNREAD"
]
}
Using the Gmail API PHP client you could do something like the following: 使用Gmail API PHP客户端,您可以执行以下操作:
$mods = new Google_Service_Gmail_ModifyMessageRequest();
$mods->setRemoveLabelIds(array("UNREAD"));
$message = $service->users_messages->modify($userId, $messageId, $mods);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.