I have a python script that connects to an IMAP server. The script downloads the mails from the server in a certain format. The second time the script is run, rather than downloading all the mails, it should download new mails (synchronize) to avoid time overhead.
I have an issue. How to detect if a certain mail has been dragged from one directory to another directory (or mailbox). E.g. if I move a mail from mailbox A to mailbox B, is there any such flag like 'MOVED' to identify such mails.
So the next time the script runs I am able to fetch RECENT or UNSEEN mails but not the one whose path on the server has been changed.
No.  There's not.  IMAP considers a moved message to be deleted from one folder and created in a new folder.  There is no continuity between folders in general.
IMAPLIB: Is there any MOVED flag to identify mails moved between mailboxes