Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import imaplib
- username = 'me'
- password = '1234'
- server = 'mail.example.com'
- M = imaplib.IMAP4(server)
- M.login(username, password)
- M.select('Deleted Items')
- typ, data = M.search(None, 'ALL')
- deleted = 0
- for num in data[0].split():
- deleted += 1
- M.store(num, '+FLAGS', '\\Deleted')
- M.expunge()
- M.close()
- M.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement