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,
Try to use https://github.com/ikvk/imap_tools
from imap_tools import MailBox # DELETE all messages from INBOX with MailBox('imap.mail.com').login('test@mail.com', 'password', 'INBOX') as mailbox: mailbox.delete([msg.uid for msg in mailbox.fetch()])