我最近永久性地切换到了简单的html版本的gmail,因为它与vimperator打得更好,现在我有4000条未读消息隐藏在社交和促销标签中。我想将所有这些标记为已读。有没有办法在不请求they do here with imaplib
之类的每条消息的情况下执行此操作答案 0 :(得分:1)
如果您想将INBOX中的所有内容标记为已读,请在登录后执行此IMAP命令并SELECT
INBOX
:
tag STORE 1:* +FLAGS (\Seen)
您可以使用imaplib,任何套接字库或仅支持SSH的TCP程序执行此操作,例如socat
或openssl s_client
。
以下是标记使用GMail读取的所有邮件所需命令的记录:
$ openssl s_client -connect imap.gmail.com:993 -crlf
* OK Gimap ready for requests from 208.65.73.143 f185mb90387173ioe
a LOGIN [username] [password]
* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT
a OK [username] [name] authenticated (Success)
b SELECT INBOX
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen $Phishing $Forwarded Yellow $NotPhishing)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $Phishing $Forwarded Yellow $NotPhishing \*)] Flags permitted.
* OK [UIDVALIDITY 7] UIDs valid.
* 3617 EXISTS
* 0 RECENT
* OK [UIDNEXT 39807] Predicted next UID.
* OK [HIGHESTMODSEQ 4076284]
b OK [READ-WRITE] INBOX selected. (Success)
c STORE 1:* +FLAGS (\Seen)
* 1 FETCH (FLAGS (\Seen))
* 2 FETCH (FLAGS (\Seen))
...
* 3617 FETCH (FLAGS (\Seen))
c OK Success
d LOGOUT
* BYE LOGOUT Requested
d OK 73 good day (Success)
如果你有很多消息,你可能希望+FLAGS.SILENT
使用STORE
命令,这不会使它将结果回显给你。