Deleting using google IMAP (python, imaplib)
-
28-09-2019 - |
Question
When I use google IMAP and try to delete message the message removes from folder but not going to trash folder. Did i must to copy this message before delete it?
Solution
Simple answer: yes.
There is no concept of Deleted Items, Trash, etc. in IMAP. If you want to have a message in one of those folders after deletion, you have to copy it.
OTHER TIPS
With the new Gmail advanced IMAP controls you can now set messeges that are deleted over imap to be moved to the bin.
Just enable "Advanced IMAP Controls" in Gmail Labs, and then set the settings IMAP settings like this:
Then when you mark a message as deleted and expunge as per this answer it will be moved to the bin.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow