I have been experimenting with JavaMail api to fetch Google Apps Email as part of a product idea. Initially, I used POP3 protocol and tried to get the Inbox and that worked just fine. Then I wanted to get the remaining Folders. Well, Google Apps EMail (which is based on their GMail software), organizes by Labels and doesn’t use folders (except may be the Inbox, I don’t know all the details). When I used POP3, the only folder that I managed to get is the INBOX folder. Then I switched to using IMAP and interestingly, it returned not just INBOX bot also the the rest are the labels that I defined. The remaining such as “Drafts”, “Sent Mail” etc provided by default by Google were not present. However, there was a special folder called “[Gmail]” which contains the standard default folders. When debugging was enabled, it indicated that the “[Gmail]” folder had something like
* LIST (\Noselect \HasChildren) “/” “[Gmail]”
while rest of them had
* LIST (\HasNoChildren) “/” “[Gmail]”
Interestingly, with POP3, even the “[Gmail]” is not present. Not sure if this is related to Google’s implementation of the protocol or some limitations in POP3 vs IMAP.