the Imap connection config in my config.inc.php is as follows. I use self signed certs.
$config['imap_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'verify_depth' => 3,
'allow_self_signed' => true,
),
);