You cannot setup IMAP on iPhone/iPad (iOS devices) with a server that only provides IMAP SSL (port 993). iOS detects the existence of IMAP by using non-SSL IMAP port, which is port 143. Here is the trick that helps you to set it up.
First, and most import, you have to disable any possible Internet connection. The easiest way is switch to airplane mode.
Go to Settings, tap on Mail, Contacts, Calendars
Tap on Add Account
Tap on Other
Enter basic information and tap Next
It would ask for you incoming and outgoing mail server. Fill in the server information. Tap Next.
It prompts for network connectivity. Tap OK to ignore it.
Tap Next again. This time you can Save.
Tap on the newly create account.
Tap on Advanced.
Enable Use SSL.
Tap Account on top left to save changes and back to previous screen.
Remember to switch back to normal mode from airplane mode before testing your email settings.