How can I delete messages from the mail box? I am using this code, but the letters are not removed. Sorry for my English.
def getimap(self,server,port,login,password):
import imaplib, email
box = imaplib.IMAP4(server,port)
box.login(login,password)
box.select()
box.expunge()
typ, data = box.search(None, 'ALL')
for num in data[0].split() :
typ, data = box.fetch(num, '(UID BODY[TEXT])')
print num
print data[0][1]
box.close()
box.logout()