使用 imap 协议 Tcpclient 将电子邮件标记为已读

Mark email as read using imap protocol Tcpclient

_imapSw.WriteLine("$ STATUS INBOX (unseen)");
_imapSw.WriteLine("$ SELECT INBOX");
_imapSw.Flush();

收到 unseen.I 封电子邮件后,想将电子邮件标记为已读。请告诉我将第一封电子邮件标记为已读的命令。 `

_imapSw.WriteLine("$ FETCH " + index + " (body[header.fields (from subject date)])"); _imapSw.WriteLine("$ FETCH " + index + " body[text]");`

我可以获取电子邮件 header 和 body 但这不是将电子邮件标记为已读。

选择收件箱时,您将获得第一封 unread/unseen 邮件的 ID。

* FLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk $Junk Junk $MDNSent $F
orwarded)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft NonJunk $Junk Jun
k $MDNSent $Forwarded \*)] Flags permitted.
* 8421 EXISTS
* 0 RECENT
* OK [UNSEEN 3395] First unseen.
* OK [UIDVALIDITY 47932578432] UIDs valid
* OK [UIDNEXT 46214] Predicted next UID
* OK [HIGHESTMODSEQ 1377] Highest

然后可以使用store命令标记为已读:

_imapSw.WriteLine("$ STORE 3395 +flags \seen");
_imapSw.Flush();