Why doesn't the JavaMail Property "mail.pop3.timeout" work ?
861912May 13 2011 — edited Jun 13 2011I wrote a email client with JavaMail API, it can access POP3 server and IMAP server.
But sometimes,it continues connectting the server but doesn't get any response.
That is to say,the program is executing the clause "store.connect();",but no response.
And sometimes,it successes to log on the server and begins downloading emails,but after getting part of the emails,it
doesn't get any response again.
To solve the two questions above,I use the JavaMail Property "mail.pop3.connectiontimeout" and "mail.pop3.timeout" to
cause Exception to log off the current mail session,but they don't work. What should I do?
Some code segment:
try
{
Properties props = new Properties();
props.put("mail.store.protocol",protocol);
props.put("mail.pop3.connectiontimeout","60000");
props.put("mail.pop3.timeout","300000");
URLName url = new URLName("pop3","serverAddress",110,null,"userName","password");
Session session = Session.getInstance(props,null);
Store store = session.getStore(url);
store.connect();
}
catch(Exception e)
{
e.printStackTrace();
}
Please help me !