throw new Exception("Folder not found or invalid: " + mailBox);
}
folder.open(Folder.READ_WRITE);
int msgCount = Math.min(folder.getMessageCount(),maxFetchSize);
DeliveryChannel channel = getDeliveryChannel();
MessageExchangeFactory mef = getExchangeFactory();
for(int i=1; i <= msgCount;i++) {
MimeMessage mailMsg = (MimeMessage) folder.getMessage(i);
InOnly io = mef.createInOnlyExchange();
NormalizedMessage normalizedMessage = io.createMessage();
this.marshaler.prepareExchange(io,normalizedMessage,mailMsg);
io.setInMessage(normalizedMessage);
channel.send(io);
mailMsg.setFlag(Flags.Flag.DELETED,true);