使用imap协议Tcpclient将邮件标记为已读
本文关键字:记为 imap 协议 Tcpclient 使用 | 更新日期: 2023-09-27 18:18:41
_imapSw.WriteLine("$ STATUS INBOX (unseen)");
_imapSw.WriteLine("$ SELECT INBOX");
_imapSw.Flush();
获得未见的电子邮件计数后。我想把邮件标记为已读。请告诉我命令将第一封邮件标记为已读。'
_imapSw。WriteLine("$ FETCH " + index + " (body[header。字段(从主题日期开始)])";_imapSw。WriteLine(" $获取" +指数+"身体[文本]");"
我可以获取邮件标题和正文,但这不是将邮件标记为已读。
选择收件箱时,您将获得第一封未读/未见邮件的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();