Skip to content

Instantly share code, notes, and snippets.

@peko
Created January 25, 2017 09:20
Show Gist options
  • Save peko/00cc6de0c35220771f41524884967169 to your computer and use it in GitHub Desktop.
Save peko/00cc6de0c35220771f41524884967169 to your computer and use it in GitHub Desktop.
Trash gmail
#!usr/bin/python
import email, imaplib
user = 'xxx'
pwd = 'xxx'
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user,pwd)
m.select("some_gmail_label")
m.store("1:*",'+X-GM-LABELS', '\\Trash')
m.expunge() # should be useless, but gmail server says it is ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment