Using JavaMail API and IMAP, i want to learn that a message has been moved from folder a to b. how can i do that without adding listeners? i mean i want to discover the changes of messages when i login to the account and open the folder.
The problem is if you have 3 messages in folder a with ids 1 2 and 3 and you move the message with id 3 to the folder B, the id of the message changes and we have a message with id 1 in folder B.
My goal is synchronizing the message structure in mail server with my own local server. I have to keep all message information, flags etc on my own. So on each login, i have to discover all the changes made to the messages stored in mail server.
I can get new or unread mails by:
Message messages[] = inbox.search(new FlagTerm(new Flags(Flag.RECENT), true));
or by
Message messages[] = inbox.search(new FlagTerm(new Flags(Flag.SEEN), false));
but i am not interested only to new mails, i also want to know the changes made to the old mails for example i want to get informed about that:
a mail which has been read 2 months ago, has been moved to another folder.
my idea is,
because the uids change, i can not use that for identifying mails. i think i have to use mail infos such as subject sender receive date, build an hashvalue of them and compare the hash values of messages on each login. but it will cause performance problems.