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.
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.
from imap_tools import MailBox, A
with MailBox('imap.mail.ru').login('test@ya.ya', 'pw', initial_folder='INBOX') as mailbox:
# MOVE all messages from current folder (INBOX) to folder2
mailbox.move(mailbox.uids(A(all=True)), 'INBOX/folder2')