Posted By:
John_Hategeka
Posted On:
Wednesday, July 31, 2002 03:04 AM
Hi! The following code fetch emails from, the INBOX folder and puts them in the message[] array. ... Properties props = System.getProperties(); session = Session.getDefaultInstance(props, null); store = session.getStore("pop3"); store.connect(host, username, password ); folder = store.getFolder("INBOX"); folder.open(Folder.READ_WRITE); Message message[] = folder.getMessages(); int nbMsg = message.length ; System.out.println(" Number messages = " + nbMsg ) ; ... I have executed the code, and it displayed the number of message
More>>
Hi!
The following code fetch emails from,
the INBOX folder and puts them in
the message[] array.
...
Properties props = System.getProperties();
session = Session.getDefaultInstance(props, null);
store = session.getStore("pop3");
store.connect(host, username, password );
folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
Message message[] = folder.getMessages();
int nbMsg = message.length ;
System.out.println(" Number messages = " + nbMsg ) ;
...
I have executed the code, and it displayed
the number of messages in the inbox folder:
Number messages = 11
I then open Outlook, checks the inbox folder,
and then close it.
I can see there are 11 unread messages.
After that, when I re-execute the code above,
it displays:
Number messages = 0
the inbox seems to be empty after using Outlook!
Why?
Thanks!
<<Less