I want to copy message from source mail server to destination mail server. i used imap protocol and javamail. For first stage, i copy message and there is not any problem. Again i copy message the already message dose not overwrite or skip copy. I want to skip message in inbox folder in the destination folder. I do not like delete source message. Thanks.
The most efficient way is to keep track of the UIDs of the messages from the source folder that you've already copied, so you don't copy them again. Depending on how you're doing the copying, you may only need to keep track of the last UID you copied, and then only copy messages with larger UIDs (newer messages). See the UIDFolder interface.