You must replace your normal mail.domain.com with the secure server name.
After purchasing an SSL certificate for mail.yourdomain.com you will need to use the following ports.
Secure POP3 is port 995.
Secure IMAP is port 993.
The outgoing mail is always SMTP, whether using IMAP or POP.
Secure SMTP is port 465.