This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

0 Messages in mailbox  RSS feed

 
marius hagiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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,
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use

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

getDefaultFolder will always return null

Rgds,

Seetesh
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!