POP3Client client = new POP3Client();
client.connect("www.discursive.com");
client.login("tobrien@discursive.com", "******");
POP3MessageInfo[] messages = client.listMessages();
for (int i = 0; i < 5; i++) {
int messageNum = messages[i].number;
System.out.println( "Message number: " + messageNum );
Reader reader = client.retrieveMessageTop( messageNum, 10 );
System.out.println( "Message:\n" + IOUtils.toString( reader ) );
IOUtils.closeQuietly( reader );
}
client.logout();
client.disconnect();