why i can not delete my email with imaplib?
elearn
elearn2014 at gmail.com
Wed Aug 6 10:03:22 EDT 2014
I have a gmail account 'xxx at gmail.com' which subscripted python
maillist. I want to delete any emails which is sent to
python-list at python.org .
|import imaplib
user="xxx"
password="yyyyyy"
con=imaplib.IMAP4_SSL('imap.gmail.com')
con.login(user,password)
con.select('[Gmail]/&YkBnCZCuTvY-')
type, data= con.search(None, "All")
type1, data1= con.search(None, '(TO "python-list at python.org")')
ids_all= set(data[0].split())
ids1=set(data1[0].split())
ids_deleted=set(ids_all-ids1)
for numin ids_deleted:
con.store(num, '+FLAGS', '\\Deleted')
con.expunge()|
When i open my gmail with thunderbird ,the emails which are sent to
python-list at python.org are still in my gmail,Why i can't delete them?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140806/bb83c167/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.png
Type: image/png
Size: 78779 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140806/bb83c167/attachment.png>
More information about the Python-list
mailing list