POP3
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Vaidehi_Kulkarni
Posted On:   Tuesday, August 7, 2001 12:44 PM

Hi, I am trying to list all the mails subjects of my yahoo mail a/c using the pop3. but I am getting following error DEBUG: getProvider() returning javax.mail.Provide [STORE,pop3,com.sun.mai POP3Store,Sun Microsystems, Inc] POP3: connecting to host "pop.mail.yahoo.com", port 110 javax.mail.MessagingException: Connect failed; nested exception is: java.net.ConnectException: Operation timed out: connect The code is as follows import javax.mail.*; import javax.activation.*; import javax.mail.internet.*; import javax.mail.Transport; import   More>>

Hi, I am trying to list all the mails subjects of my yahoo mail a/c using the pop3. but I am getting following error



DEBUG: getProvider() returning
javax.mail.Provide
[STORE,pop3,com.sun.mai POP3Store,Sun Microsystems, Inc]

POP3: connecting to
host "pop.mail.yahoo.com", port 110

javax.mail.MessagingException: Connect failed;


nested exception is:
java.net.ConnectException:
Operation timed out: connect







The code is as follows



import javax.mail.*;

import javax.activation.*;

import javax.mail.internet.*;

import javax.mail.Transport;

import javax.mail.Folder;

import javax.mail.Store;




public class readMail {

String host = "pop.mail.yahoo.com";

String username ="user_id"; //yahoo mail id .

String password ="password";




public readMail() {

try{

Properties props = new Properties();

props.put("mail.pop3.host", host);

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



session.setDebug(true);


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


store.connect(host,username,password);


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


folder.open(Folder.READ_ONLY);


Message message[]=folder.getMessages();


for(int i=0,n=message.length;i



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



}

folder.close(false);


store.close();


}catch(Exception e){


System.out.println("oops!!!"+e);


}


}


public static void main(String args[])

{


readMail rm = new readMail();


}


}



Do I have to do any set up for pop3?
I am using javaMail 1.2

I have included mail.jar,pop3.jar and activation.jar in my classpath.


Help is appreciated.

   <<Less
About | Sitemap | Contact