Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75803

why i can not delete my email with imaplib?

Date 2014-08-06 22:03 +0800
From elearn <elearn2014@gmail.com>
Subject why i can not delete my email with imaplib?
Newsgroups comp.lang.python
Message-ID <mailman.12703.1407336221.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I have a gmail account 'xxx@gmail.com' which subscripted python 
maillist. I want to delete any emails which is sent to 
python-list@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@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@python.org are still in my gmail,Why i can't delete them?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

why i can not delete my email with imaplib? elearn <elearn2014@gmail.com> - 2014-08-06 22:03 +0800

csiph-web