I need to extract some data from new (unseen) messages; I'm trying to make range of that data:
c, _ = imap.Dial("someserverr")
defer c.Logout(30 * time.Second)
fmt.Println("Server says hello:", c.Data[0].Info)
c.Data = nil
if c.State() == imap.Login {
c.Login("somedata", "somedata")
}
c.Select("INBOX", false)
set, _ := imap.NewSeqSet("")
fmt.Println("unseen", c.Mailbox.Unseen)
fmt.Println(c.Mailbox)
if c.Mailbox.Unseen >= 1 {
set.AddRange(1, c.Mailbox.Unseen)
} else {
set.Add("0:0")
}
The main problem here is command c.Mailbox
showing wrong number of unseen messages.
For example, if I have 5 unread messages in INBOX it shows 1. If I mark that one as read, it will show 4, and so on.