Advertisement
Guest User

Untitled

a guest
May 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import imaplib
  2.  
  3. username = 'me'
  4. password = '1234'
  5. server = 'mail.example.com'
  6. M = imaplib.IMAP4(server)
  7. M.login(username, password)
  8. M.select('Deleted Items')
  9. typ, data = M.search(None, 'ALL')
  10. deleted = 0
  11. for num in data[0].split():
  12.     deleted += 1
  13.     M.store(num, '+FLAGS', '\\Deleted')
  14. M.expunge()
  15. M.close()
  16. M.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement