/*
*Author:tyfun
*DateTime:2003.01.10
*Package:com.westarsoft.mail
*/
package com.westarsoft.mail;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class GetMail {
public static String receive(String popServer, String popUser, String popPassword) {
String mailContent = "";
Store store = null;
Folder folder = null;
try {
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
folder = store.getDefaultFolder();
if(folder == null) throw new Exception("No default folder");
folder = folder.getFolder("INBOX");
if(folder == null) throw new Exception("No POP3 INBOX");
folder.open(Folder.READ_ONLY);
Message[] msgs = folder.getMessages();
for(int msgNum = 0; msgNum < msgs.length; msgNum++) {