Reputation: 71
I'm trying to write a script which moves a particular email to Archive after getting its text, however I've looked all over the place and tried plenty of solutions. My understanding is that when a message is archived, all of its labels are removed and it only appears in the All Mail folder.
This is my current code to try to remove any labels associated with the message, I believe that this should archive the message, however it seems to do nothing. There are no errors when running this code.
one, two = self.connection.store(msg_id, '-X-GM-LABELS', "\Inbox \Important \Sent \Seen")
Thanks!
Upvotes: 0
Views: 1960
Reputation: 71
The Delete flag is not the same as the Trash flag, so if you set Delete, it will move it to the archive by removing any excess labels
self.connection.store(msg_id, '+FLAGS', '\\Deleted')
Upvotes: 3