problem fetching the mails

I am writing a simple program to fetch the mails from the mail server using the following code :

public static void main (String args[]) throws Exception {

String username = args[0];

String password = args[1];

Properties props = new Properties();

Session session = Session.getDefaultInstance(props, null);

Store store = session.getStore("pop3");

store.connect("pop.mail.yahoo.com", username, password);

Folder folder = store.getFolder("INBOX");

folder.open(Folder.READ_ONLY);

BufferedReader reader = new BufferedReader (

new InputStreamReader(System.in));

Message message[] = folder.getMessages();

for (int i=0, n=message.length; i<n; i++) {

System.out.println(i + ": " + message.getFrom()[0]

+ "\t" + message.getSubject());

System.out.println("Do you want to read message? [YES to read/QUIT to end]");

String line = reader.readLine();

if ("YES".equals(line)) {

System.out.println(message.getContent());

} else if ("QUIT".equals(line)) {

break;

}

}

folder.close(false);

store.close();

}

In this code at the line :

Store store = session.getStore("pop3");

it throws an exception while executing the program : javax.mail.NoSuchProviderException : pop3

i have placed the pop3mail.jar, mail.jar & activation.jar in my classpath still this is the problem.

is there any other provider that is needed ? and if yes from where to get that and where to specify that ?

reply highly appreciable .

thanx

>

[1650 byte] By [anilshokeen] at [2007-9-26 12:47:59]
# 1

Try changing the store/connection portion of your code from:

Store store = session.getStore("pop3");

store.connect("pop.mail.yahoo.com", username, password);

tp:

Store store = session.getStore("pop.mail.yahoo.com",username,password);

store.connect();

Sean

tus at 2007-7-2 12:19:48 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...