Gmail邮件阅读后如何删除?尝试到处寻找但找不到适合我的解决方案。目前,下面的代码读取主题和正文,我想在阅读后立即删除该特定邮件
$service = new Google_Service_Gmail($client);
foreach ($messages as $message){
$msg = $service->users_messages->get($userId, $message->getId());
$headers = $msg->getPayload()->getHeaders();
$subject = array_values(array_filter($headers, function($k){
return $k['name'] == 'Subject';
}));
$subject = $subject[0]->getValue();
$body = base64_decode(var_export($msg->payload->body->data, true)));
}
慕森王