Hi everybody,
I'm having some trouble using Imap IDLE and mail integration. Everything is working fine so far, as long as I'm only dealing with messages and their contents.
I commented out what is not working right now. But an NPE is thrown when I try to access anything on the Folder Object. Problem is, that this takes away most of the control we have over messages. I'd want to 'rollback' anything that didn't get processed properly and have it double-checked by something else, moved somewhere else in the Imap tree, and so on.Code:public void pushMimeMessage(MimeMailMessage incomingMessage){ //TODO: Do something useful here and postprocess messages, //not to mention get them off the server :) StrippedMessage strippedMessage = null; MimeMessage mimeMsg = incomingMessage.getMimeMessage(); try { InternetAddress[] from = (InternetAddress[])mimeMsg.getFrom(); String fromAddress = from[0].getAddress(); log.debug("Content-Type: "+mimeMsg.getContentType()); log.debug("Received: "+incomingMessage.getMimeMessage().getSubject()); /*if (mimeMsg.getFolder().isOpen()){ //do nothing }else { log.debug("Trying to open folder in RW mode..."); mimeMsg.getFolder().open(Folder.READ_WRITE); } log.debug("Current Folder: "+mimeMsg.getFolder().getFullName());*/ //FIXME: Figure out how to access folders... //We need this to delete any leftover mail...
Another issue for me is that the push-method is the only thing working right now. Meaning, it doesn't care about any new messages on the server (after a certain downtime for instance), it only processes messages the moment they're received. I planned on doing some clean-up in the constructor, when Spring creates the object, but there's no way to re-use the configuration I already made when I can't access the folders.
Using Spring 3.0.2 with SI + Mail 2.0.3 - Maven doesn't complain about any incompatibilities, but I read somewhere in the forum that 3.0.5 is needed for SI 2+.
My question is: Does it work as designed? Am I not supposed to access the folders or do any rollback or post-processing on the messages or is this a bug or an incompatibility?
I'd be glad about any sort of help.
Cheers from germany.
Andreas
Edit: Totally forgot: Using javamail 1.4.4 of course, read about the issues with earlier versions, so that should not be the problem.


Reply With Quote

