IMAP setup

I have tried to set up the IMAP settings. shows this error:
************************
Failed to connect to the IMAP server.
******************************

am using cpanel and i have tried to copy the server and port from my email client.

Please advice