dcsimg
How to read a mail from pop3
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Imthiyaz_Ahmed
Posted On:   Tuesday, May 29, 2001 05:46 AM

I am getting No such provider exception .Please help me. // String host1 ="ip address" ; String from1 = "isikkander"; String to1 = "rahza511"; Properties prop1 =System.getProperties(); prop1.put ("mail.pop3.host",host1); // Setup mail server try { Session session1 = Session.getDefaultInstance(prop1,null); // Store store = session1.getStore (session1.getProvider("pop3")); // Store store = session1.getStore ("pop3"); Store store = session1.getStore ("pop3"); store.connect (host1,from1,to1); Folder fol   More>>

I am getting No such provider exception .Please help me.





// String host1 ="ip address" ;
String from1 = "isikkander";
String to1 = "rahza511";


Properties prop1 =System.getProperties();
prop1.put ("mail.pop3.host",host1);

// Setup mail server
try
{
Session session1 = Session.getDefaultInstance(prop1,null);


// Store store = session1.getStore (session1.getProvider("pop3"));


// Store store = session1.getStore ("pop3");


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


store.connect (host1,from1,to1);

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

folder.open (folder.READ_ONLY );

Message mess[] =folder.getMessages ();
for(int i=0 ,n=mess.length;i
{
System.out.println (mess[i].getFrom ()[0] +" " +mess[i].getContent ());



}
// folder.close ();
store.close ();
}catch(Exception e)
{
e.printStackTrace ();
}

   <<Less

Re: How to read a mail from pop3

Posted By:   John_Zukowski  
Posted On:   Tuesday, May 29, 2001 10:06 AM

As already covered in the FAQ, the POP3 classes are not part of Java 1.1. You have to download separately.

Re: How to read a mail from pop3

Posted By:   Anonymous  
Posted On:   Tuesday, May 29, 2001 06:21 AM

this looks like a problem with your classpath. You have to put the pop3.jar in

/jdk/jre/lib/ext/ for an jdk (>1.2) or
/jre/lib/ext/ for jre

or manual in your classpath :

java -classpath .:/bla/pop3.jar: theprogi.class

Alex
ps: you have also put the mailapi.jar into classpath ..
About | Sitemap | Contact