The PopClient class I've written for Veep should be fully reuseable by any Java-based application that requires the ability to communicate with POP3 email servers.
Known Issues - PopClient works fine with my ISP's mail server. I know, however, that it won't work with mail servers that produce different responses. Once Veep is functional I'll change the implementation of PopClient to hopefully make it inter-operable with any type of Pop3 server.
Methods
PopClient(int, String) - The constructor takes two arguments. The String is the name of the mail server to connect to, the int is the port number to connect on. Although this number should always be 110 its safer to leave it as a user defined value. The constructor opens a socket connection to the specified host and establishes a reader and writer to it.connect(String, String) - connect takes the username and password for the server and passes them to it. At the moment this method has no capacity to cope with incorrect logins.
listMessages() - This method retreives the message data from the server and stores it in three arrays - senders[] contains the names of the senders of the messages, dates[] contains the date of the messages and sizes[] contains the sizes of the messages.
retreive(int, String) - This method retreives the message specified by the int and writes it to the file named by the String. POPCLIENT writes every message to a unique file - I have my reasons for trying this but I may change it in the future if it proves too much hassle.
delete(int) - Deletes the message specified by the arg from the server.
disconnect() - Closes the connection to the server.
getNoOfMessages() - returns a String containing the number of messages on the server.
getSenders(int) - returns a String containg the sender of the message specified in the arg.
getDates(int) - returns a String containing the date of the specified message was received.
getSizes(int) - returns a String containing the size of the specified message.