Improve IMAP server connection error handling