php - 通过 IMAP 删除 GMail 聊天记录

标签 php gmail imap

我使用 Zend_Mail_Storage_Imap 创建了一个小脚本来与 GMail 交互。到目前为止一切正常,但我无法删除我的聊天记录? 所以我尝试将它们移至“Bin”:

REQUEST: TAG18 COPY 1,2,3,4,5,6,7,8,9,10 "[Google Mail]/Bin"
RESPONSE: TAG18 NO [ALERT] Chats can only exist in the Chat folder (Failure)

明显没用... 比我尝试在它们上设置删除标志:

REQUEST: TAG19 STORE 1,2,3,4,5,6,7,8,9,10 +FLAGS (\Deleted)
RESPONSE: TAG19 NO STORE attempt on READ-ONLY folder (Failure)

也没解决。

我该怎么做才能将聊天记录移至垃圾箱?我可以在 GMail 界面中手动执行此操作,但我想自动执行此操作...

谢谢!

最佳答案

Searching around您会发现其他程序员也遇到了同样的问题:聊天标签显示为只读。所有搜索结果都是其他程序员提供自己对问题的反馈,并确认聊天标签确实是只读的。令人沮丧的是,我找不到谷歌专门关于这个主题的官方文档。

我能找到的关于该主题的最接近的“官方”帖子来自 Google 员工的评论 Brandon LongGoogle+ post上: Gmail Liberates Recorded Chat Logs Via IMAP - Data Liberation 。添加了重点。

2011 年 9 月 15 日评论

Yes, currently chats are only displayed in the Chats folder. The Chats folder is also currently read-only, you can only export chats from there... though you can then upload those chats to another folder usually without issue. There are some technological reasons for this, chats have a bunch of special handling in the Gmail server, and are not 'real' email messages. This means that in some cases, a chat message may violate the IMAP spec in terms of message immutability. It was considered safer to silo them only in the Chats folder, which could ultimately be unsubscribed from or hidden entirely from IMAP if a user encounters problems with their client. We have fixed a number of bugs with chat exposure, hence the reason this has launched, but we're still a bit leery of potentially breaking things. Historical note, chats were exposed up until the last couple weeks before the initial IMAP launch, but the large number of bugs made us decide to just hide them. The DLF team has been instrumental in working to expose them for your liberation pleasure.

Note you can access the full list of labels on any message (chat or otherwise) by using the X-GM-EXT1 extension, http://code.google.com/apis/gmail/imap/, and using the X-GM-LABELS message fetch attribute

关于php - 通过 IMAP 删除 GMail 聊天记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12073890/

相关文章:

php - YII CGridView。试图显示其他表的属性。关系不工作

PHP/MySql : find missing records by comparing to lists

php - 如何防止在同一字段中替换两个值?

Java 邮件 : How to use SOCKS for IMAP processing without global sytem properties?

php - Laravel HasManyThrough 带有 where 语句

ios - 使用 Facebook、Twitter 或 GMail 登录我的应用程序

java - Gmail 也从已发送邮件中获取邮件

javascript - 如何实现 gmail 风格的标签选择器?

search - imap "search all"范围 : all folders/current folder?

python - 如何让我的电子邮件每封电子邮件只显示一次?