Reputation: 2862
I'm looking to develop Go code to read email from an IMAP server and then delete the message (i.e. flag it /Deleted and expunge). This is not how to do it, as it seems to be a no-op. The variable message_id is an uint32 message number.
delset, _ := imap.NewSeqSet(string(message_id))
cmd2, err = client.Store(delset, "+FLAGS", "/Deleted")
if err != nil {
fmt.Printf("Error on store command, err: %s\n", err)
return
}
// below just stalls in a wait forever...
// Process responses while the command is running
// for cmd2.InProgress() {
// // Wait for the next response (no timeout)
// // client.Recv(-1)
// // Process command data
// for _, rsp2 = range cmd2.Data {
// fmt.Println("Response from store")
// fmt.Println(rsp2)
// }
// }
// And later:
// Expunge
cmd3, err = client.Expunge(nil)
Upvotes: 0
Views: 2136
Reputation: 2862
I got directed to the answer found in demo code that is part of the package.
https://github.com/mxk/go-imap/blob/master/imap-demo/demo1.go#L94
Note, this package location is preferred over the code.google.com location. And, yes, the flag is \Deleted.
Upvotes: 0