JavaMail API: Problems Getting Folder Names

Posted on 2009-04-22
Last Modified: 2013-11-24
I am writing an application that can communicate with IMAP Servers and will allow the user to
access multiple folders on the server and access and manipulate the different messages that are in these folders.
 I am testing my application using my personal gmail account and am having difficulty getting the names of the folders in the account.  I know that there are 8 different folders in the account
but when I run the code below I get no folder names listed and the number of folders is stated as 1.  

Folder[] folders= store.getPersonalNamespaces();

for(int i=0; i<folders.length; i++)

          System.out.println("Folder #" + i + " is: " + folders[i].getName());

          System.out.println("The folder size is: " + folders.length);

Open in new window

Question by:Genus1
    1 Comment
    LVL 59

    Accepted Solution

    Folder[] folders = store.getDefaultFolder().list();

    That works for me on AOL and GMAIL IMAP.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now