FileDocCategorySizeDatePackage
POPExample.javaAPI DocExample1871Wed May 18 09:39:02 BST 2005com.discursive.jccook.net

POPExample

public class POPExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		new POPExample().start();
	
public voidstart()

		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();