imap - how to delete messages

后端 未结 9 692
孤独总比滥情好
孤独总比滥情好 2020-12-14 08:00

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,         


        
9条回答
  •  我在风中等你
    2020-12-14 08:25

    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()])
    

提交回复
热议问题