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

时间:2015-10-21 07:51:57

标签: c# email imap tcpclient

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

获取看不见的电子邮件数量后。我想将电子邮件标记为已读。请告诉我将第一封电子邮件标记为已读的命令。 `

_imapSw.WriteLine(“$ FETCH”+ index +“(body [header.fields(来自主题日期)])”);  _imapSw.WriteLine(“$ FETCH”+ index +“body [text]”);`

我可以获取电子邮件标题和正文,但这并不是将电子邮件标记为已读。

1 个答案:

答案 0 :(得分:0)

选择收件箱时,您会收到第一封未读/未读邮件的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命令将其标记为read:

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