// Get mails
List<Message> mailsList = new ArrayList<Message>();
javax.mail.Message[] popMails = folder.getMessages();
for( javax.mail.Message msg : popMails)
mailsList.add( new Message( msg ) );
// Close connection
folder.close(false);
store.close();