Confused in store.connect() function
843830May 14 2006 — edited Nov 28 2007I 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.