Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Confused in store.connect() function

843830May 14 2006 — edited Nov 28 2007
I use follow way to connect to a pop3 server:
Properties pro = System.getProperties();
pro.put("mail.pop3.user",userName);
pro.put("mail.pop3.host",host);
pro.put("mail.pop3.port",port); // port is 111, not a standard port
Session session = Session.getInstance(pro,new SimpleAuthenticator(userName,password));
Store store = session.getStore(protocol);
store.connect();
But system cann't connect to the host, error messege is "Connect failed", store.getURLName will print "pop3://username@host", there is no port info in it and I debug the program in Service class, port is default 110, why it is not 111?

Then I use store.connect(host,port,username,password) to connect the server, system can connect, no problem. So confused.

Any one know what's the reason? Thanks very much.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 26 2007
Added on May 14 2006
14 comments
481 views