某些电子邮件的多个标签

问题描述 投票:2回答:1

当我们在发送邮件后删除邮件时,UI会仅显示“垃圾箱”标签。但是,API显示“已发送”和“已删除邮件”

{
 "id": "16169c0c3d212e74",
 "threadId": "16169c0c3d212e74",
 "labelIds": [
  "TRASH",
  "SENT"
 ],
 "snippet": "#Testing ",
 "historyId": "1893418",
 "internalDate": "1517897696000",
 "payload": {
  "partId": "",
  "mimeType": "multipart/alternative",
  "filename": "",
  "headers": [
   {
    "name": "MIME-Version",
    "value": "1.0"
   },
   {
    "name": "Received",
    "value": "by xx.xx.xx.xx with HTTP; Mon, 5 Feb 2018 22:14:56 -0800 (PST)"
   },
   {
    "name": "Date",
    "value": "Tue, 6 Feb 2018 11:44:56 +0530"
   },
   {
    "name": "Delivered-To",
    "value": "xxx@xxx"
   },
   {
    "name": "Message-ID",
    "value": "xxx"
   },
   {
    "name": "Subject",
    "value": "TEST2"
   },
   {
    "name": "From",
    "value": "xxx"
   },
   {
    "name": "To",
    "value": "xxxx"
   },
   {
    "name": "Content-Type",
    "value": "multipart/alternative; boundary=\"f403045c3c98fab46e05648518a7\""
   }
  ],
  "body": {
   "size": 0
  },
  "parts": [
   {
    "partId": "0",
    "mimeType": "text/plain",
    "filename": "",
    "headers": [
     {
      "name": "Content-Type",
      "value": "text/plain; charset=\"UTF-8\""
     }
    ],
    "body": {
     "size": 423,
     "data": "----"
    }
   }
  ]
 },
 "sizeEstimate": 1810
}

有些邮件也有[SENT,INBOX]等标签。有没有办法获得最新或最相关的标签。我想根据标签对邮件进行分类,多个标签会产生矛盾。

google-api gmail-api
1个回答
1
投票

发送电子邮件后,它会获得SENT标签。如果您要删除电子邮件,则需要添加TRASHED标签。它不会删除任何已添加的其他标签。

我怀疑Gmail的UI版本有一个过滤器,它不会在已发送的邮箱中显示已删除的邮件。

解决方案:当您丢弃电子邮件时,请务必删除SENT标签,或者只删除应用程序中具有已删除标签的所有其他标签。

gmail api会将您拥有的数据返回给您,以确保在您删除电子邮件或过滤掉您不感兴趣的标签后删除其他标签,从而确保其只有正确的数据。

© www.soinside.com 2019 - 2024. All rights reserved.