About pop3

I use these program to get the email from my email server:

Properties props = System.getProperties();

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

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

store.connect(email_host,username,password);

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

folder.open(Folder.READ_ONLY);

Message message[] = folder.getMessages();

It can login successfully. But the length of the array message is always zero. I am sure there are many mails in my email box. Why can't I get any of them?

Thanks

[666 byte] By [youhaodiyia] at [2007-11-27 9:52:33]
# 1
try folder.getMessageCount() and see what it returns.also try the folder.getMessages(endIndex, startIndex);
zparticlea at 2007-7-13 0:21:38 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

See the JavaMail FAQ to learn how to turn on session debugging and

examine the protocol trace to see what exactly your server is telling you.

Most likely, if JavaMail is not returning any messages, it's because your

server says there are no messages.

Note that if you've used another mail client to read your messages from

you POP3 server, that client has probably downloaded the messages and

deleted them from the server. They may still be visible to the other client,

but they're not on the server anymore.

bshannona at 2007-7-13 0:21:38 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...