Iterator<MessageResult> messageResultIterator = srcMessageManager.getMessages(MessageRange.all(), FetchGroupImpl.FULL_CONTENT, srcMailboxSession);
while (messageResultIterator.hasNext()) {
MessageResult messageResult = messageResultIterator.next();
InputStreamContent content = (InputStreamContent) messageResult.getFullContent();
dstMailboxManager.startProcessingRequest(dstMailboxSession);
dstMessageManager.appendMessage(content.getInputStream(), messageResult.getInternalDate(), dstMailboxSession, messageResult.getFlags().contains(Flag.RECENT), messageResult.getFlags());
dstMailboxManager.endProcessingRequest(dstMailboxSession);
log.info("Message #" + j + " appended in destination mailbox with path=" + mailboxPath.toString());
j++;
}