importjava.util.Properties;importjavax.mail.Folder;importjavax.mail.Message;importjavax.mail.Session;importjavax.mail.Store;publicclassMainClass{publicstaticvoidmain(String[]ARGs)throwsException{Propertiesprops=newProperties();Stringhost="yourHost.edu";Stringusername="userName";Stringpassword="mypassword";Stringprovider="pop3";Sessionsession=Session.getDefaultInstance(props,null);Storestore=session.getStore(provider);store.connect(host,username,password);Folderinbox=store.getFolder("INBOX");if(inbox==null){System.out.println("NoINBOX");System.exit(1);}inbox.open(Folder.READ_ONLY);Message[]messages=inbox.getMessages();for(inti=0;i<messages.length;i++){System.out.println("Message"+(i+1));messages[i].writeTo(System.out);}inbox.close(false);store.close();}}下載地址:JavaMailPOP3Client.zip( 2,313 k)