Javamail with Domino POP3

When i connect to Domino Server using POP3 protocol, i am not able to retrieve all mails in the INBOX folder. The API does not return all the mails. Moreover, the bahaviour is random. i.e. The no. of mails retrieved varies. Most of the times, none of the mails are retrieved. Using IMAP retrieves all mails always. However, i need to use POP3.

Following is the code-

Properties props = System.getProperties();

Session session = Session.getDefaultInstance(props,null);

Store store = session.getStore("pop3");

store.connect("host","user","password");

Folder inbox = null;

inbox = store.getFolder("Inbox");

inbox.open(Folder.READ_WRITE);

Message[] messages = inbox.getMessages();

System.out.println("Inbox Number of Messages: " + messages.length);

Please help.

[832 byte] By [neha_83a] at [2007-11-26 19:23:47]
# 1

JavaMail can only show you what the server tells it using the POP3 protocol.

Turn on session debugging and examine the protocol trace to see what the

server is telling the client. If you think there's 37 messages in the INBOX but

the server only tells the client about 3 messages when using the POP3

protocol, there's not much that JavaMail can do about that. Check your

server for configuration options that might effect which messages it exposes

through the POP3 protocol.

bshannona at 2007-7-9 21:45:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Thanks for the prompt reply Bill.

I turned on the session debug. Foll is the trace-

DEBUG: setDebug: JavaMail version 1.3.3ea

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]

DEBUG POP3: connecting to host "10.88.45.174", port 110, isSSL false

S: +OK Lotus Notes POP3 server version Release 7.0.2 ready on ps0241/persistent.

C: USER User1

S: +OK User1, your papers please.

C: PASS pass12345

S: +OK User1 has 0 messages.

C: STAT

S: +OK 0 0

C: NOOP

S: +OK

Inbox Number of Messages: 0

neha_83a at 2007-7-9 21:45:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Seems pretty clear, doesn't it? The server tells JavaMail that it has zeromessages, and that's what JavaMail tells you. If you think that's the wronganswer, the problem is in the server, not in JavaMail.
bshannona at 2007-7-9 21:45:46 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...