Взглянув на 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
Обратите внимание, что Replace действительно удаляет все флаги. Вы должны обрабатывать (добавить в сращивании в качестве строковых значений), что вы хотите сохранить:
- \ Seen
- \ Ответил
- \ FLAGGED
- \ Удалено
- \ Draft
- \ Последние
Вы можете получить предыдущие значения из 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)
}