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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With