简体   繁体   中英

How do I move emails into folders using the IMAP library in python?

How do I move emails into folders using the IMAP library in python?

Trying to move an email from one folder into another. I have the uid of the emails that I want to move.

with MailBox('imap.mail.com').login('test@mail.com', 'pwd', initial_folder='INBOX') as mailbox:
    # MOVE all messages from current folder (INBOX) to folder2
    mailbox.move(mailbox.fetch(), 'INBOX/folder2')

Lib: https://github.com/ikvk/imap_tools

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM