tags:

views:

80

answers:

2

I am using IMAP protocol to connet to my gmail account.

My application fails at this line. message.setFlag(Flags.Flag.SEEN, true);

And the log details are as follows:

[java] ---- exception report ----------------------------------------------------------
 [java] An error Occured while reading mail
 [java] Exception: javax.mail.MessagingException
 [java] Message: A10 NO STORE attempt on READ-ONLY folder (Failure)
 [java] ---- cause ---------------------------------------------------------------------
 [java] Exception: com.sun.mail.iap.CommandFailedException
 [java] Message: A10 NO STORE attempt on READ-ONLY folder (Failure)
 [java] ---- stack trace ---------------------------------------------------------------
 [java] com.sun.mail.iap.CommandFailedException: A10 NO STORE attempt on READ-ONLY folder (Failure)
 [java] com.sun.mail.iap.Protocol.handleResult(Protocol.java:294)
 [java] com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1294)
 [java] com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1279)
 [java] com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:843)
 [java] javax.mail.Message.setFlag(Message.java:565)

Any help will be appreciated.

Thanks, Kumaraswamy.N

A: 

I'm getting the same problem with the Net::IMAP ruby library.

Nick
+1  A: 

It looks like you opened your folder as READ_ONLY. Make sure you are doing

folder.open(Folder.READ_WRITE)

when you open your folder.

BTW POP protocol doesn't recognize Flags. So I'm surprised it works for POP since you should be getting an IllegalWriteException when using POP. Regardless, message.setFlag(...) won't do anything with POP.

Nick