• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

0 Messages in mailbox

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there!
Something realy strange happens when i try to connect and retrieve the messages in a mailbox.I connect to the mbox and then ask the number of messages in that folder with a code like that;

store.connect("localhost","someuser","somepassword");
Folder folderdef=store.getDefaultFolder();
Folder folder=folderdef.getFolder("INBOX");
folder.open(Folder.READ_ONLY);

Message [] mes=folder.getMessages();
System.out.println(mes.length);
folder.close(true);
store.close();

The response is 0 messages
When I connect to that mailbox with another mailclient i can see that there are many messages in that folder
All this in a try/catch section. No exceptions thrown
The mail server is local

Can anybody help me with my problem?
Regards,
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use

folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);

getDefaultFolder will always return null

Rgds,

Seetesh
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic