Sunday, May 8, 2011

javax.mail.MessagingException: A12 NO Mailbox does not exist, or must be subscribed to

This one has been a long time coming...
One of the apps I have worked on uses Postfix + IMAP for email. One of the users was unable to get to her/his mailbox and in the apps logs for that user we were seeing :


Caused by: javax.mail.MessagingException: A12 NO Mailbox does not exist, or must be subscribed to.;
  nested exception is:
        com.sun.mail.iap.CommandFailedException: A12 NO Mailbox does not exist, or must be subscribed to.
        at com.sun.mail.imap.IMAPFolder.getMessageCount(IMAPFolder.java:1206)
        at com.altair.cls.common.messaging.eis.mail.MailMessageDAO.getMailBoxLineItem(MailMessageDAO.java:1083)
        at com.altair.cls.common.messaging.eis.mail.MailMessageDAO.getMailBoxLineItems(MailMessageDAO.java:1020)
        ... 50 more
Caused by: com.sun.mail.iap.CommandFailedException: A12 NO Mailbox does not exist, or must be subscribed to.
        at com.sun.mail.iap.Protocol.handleResult(Protocol.java:340)
        at com.sun.mail.imap.protocol.IMAPProtocol.status(IMAPProtocol.java:855)
        at com.sun.mail.imap.IMAPFolder.getStatus(IMAPFolder.java:1359)
        at com.sun.mail.imap.IMAPFolder.getMessageCount(IMAPFolder.java:1185)



We give users the ability to create custom mail folders and subfolders. This particular one did create a custom  folder and also a subfolder inside it, so the mailbox on the files system had the likes of:


Then at some point she/he attempted to delete the custom folder "CustomFolder" in this case, but something bleeped in the system and the parent "CustomFolder" was deleted, but the child "CustomFolder.subfolderOfCustomFolder" remained in the filesystem:


So the next time the user attempted to access her/his mailbox, she/he was unable to and the above mentioned exception was showing in the logs. We could not figure out what caused the subfolder to not delete, but deleting the subfolder, in this case "CustomFolder.subfolderOfCustomFolder", from the file system enabled the user to access her/his mailbox again. Hope this helps someone at some point.

No comments:

Post a Comment