Setting connection timeout |
You can use the Imap#setTimeout method to define the maximum number of milliseconds to wait when establishing a connection to an IMAP4 server. Failure to establish a connection within the maximum time allowed will result in an exception of type ImapException to be thrown.
Example
// set connection timeout to 5 seconds imap.setTimeout(5000);
// connect imap.connect(); |