简体   繁体   中英

Move to Gmail Archive - Python Imaplib

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!

Delete标记与Trash标记不同,因此,如果设置Delete,它将通过删除多余的标签将其移动到存档中

self.connection.store(msg_id, '+FLAGS', '\\Deleted') 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM