2 回答

TA貢獻1804條經驗 獲得超7個贊
看看RFC3501和Replace的文檔,它看起來有點亂。調查 Replace 的來源,它只需要一個 [] 字符串,其中包含來自 RFC3501 的關鍵字。所以,例如
flags := []string{}
// ....
_, err = imap.Wait(c.UIDStore(set, "+FLAGS", imap.Replace(flags)))
// Since the "\Seen" is not in splice, the message will be unseen
請注意,替換確實刪除了所有標志。您必須處理(作為字符串值添加到拼接中)要保留的內容:
\看過
\回答
\標記
\已刪除
\草案
\最近的
您可以從 MessageInfo struct / Flags 獲取以前的值:
type MessageInfo struct {
Attrs FieldMap // All returned attributes
Seq uint32 // Message sequence number
UID uint32 // Unique identifier (optional in non-UID FETCH)
Flags FlagSet // Flags that are set for this message (optional)
InternalDate time.Time // Internal to the server message timestamp (optional)
Size uint32 // Message size in bytes (optional)
}

TA貢獻1900條經驗 獲得超5個贊
你可以用另一種方式來做。您可以刪除標志。例子:
flags := `\Seen`
tmpSet, _ := imap.NewSeqSet("")
tmpSet.AddNum(emailUid)
_, err = imap.Wait(c.UIDStore(tmpSet, "-FLAGS", imap.NewFlagSet(flags)))
- 2 回答
- 0 關注
- 267 瀏覽
添加回答
舉報