import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
/**
* A simple email receiver class.
*/
public class SimpleReceiver{
/**
* Main method to receive messages from the mail server specified
* as command line arguments.
*/
public static void main(String args[]){
try{
String popServer=args[0];
String popUser=args[1];
String popPassword=args[2];
receive(popServer, popUser, popPassword);
}catch (Exception ex){
System.out.println("Usage: java com.lotontech.mail.SimpleReceiver"+" popServer popUser popPassword");
}
System.exit(0);
}
/**
* "receive" method to fetch messages and process them.
*/
public static void receive(String popServer, String popUser, String popPassword){
Store store=null;
Folder folder=null;
try{
// -- Get hold of the default session --
Properties props = System.getProperties();