如何将邮件标记为已读,\ IMeen(Go) [英] How to mark a message as read , \Seen on IMAP ( Go )

查看:386
本文介绍了如何将邮件标记为已读,\ IMeen(Go)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将邮件/邮件列表标记为 \SEEN (永久)使用 IMAP 。然而,与抓取,搜索和朋友不同,imap软件包似乎没有Flag功能。我应该使用UID发送原始命令吗?

I'm trying to mark a message/list of messages as "\SEEN" (permanently) using IMAP . However unlike fetch, search and friends there seem to be no Flag function on the imap package. Should I send raw commands with the UIDs ?

推荐答案

您必须选择邮箱为可写

You have to select the mailbox as writable

youImapConnection.Select(mailboxName, false) // true would be for readonly

然后简单地执行以下操作:

And then simply do the following

seq, _ := imap.NewSeqSet("")
err := seq.AddNum(612) // 612 is your UID
_, err = imap.Wait(youImapConnection.UIDStore(seq, "+FLAGS", imap.NewFlagSet(`\Seen`))) // Here you tell to add the flag \Seen

最后你会必须清除:

Finally you will have to expunge:

_, err := imap.Wait(youImapConnection.Close(true)) // Here you tell to apply changes, necessary if you mark an Email as deleted

您应该很好: - )

不要犹豫,浏览文档/源代码,这很容易理解,你会发现你需要的一切。

And do not hesitate to browse the doc/source code, it's easy to understand and you'll find all you need.

这篇关于如何将邮件标记为已读,\ IMeen(Go)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆