I want to refactor an email handling code, I know you can remove multiple messages in one operation, but to move multiple messages to a certain folder,
I use the IMAP protocol.
I want to refactor an email handling code, I know you can remove multiple messages in one operation, but to move multiple messages to a certain folder,
I use the IMAP protocol.
Yes, it does. I've implemented a function for this, it's quite easy!
public void saveMessages(Message[] mArray, String folderName) throws Exception{
//Primeiro copiamos...
Folder f = findFolder(folderName);
currentFolder.copyMessages(mArray, f);
// Depois removemos do diretório antigo!
for ( int i = 0; i < mArray.length; i++){
mArray[i].setFlag(Flags.Flag.DELETED, true);
}
currentFolder.expunge();
}