We can test IMAP service by using following simple script.
<?
$mbox = imap_open(“{mail.loacalhost:143/novalidate-cert}INBOX”, “test@test123.com”, “1q2w3e”);
print_r(imap_errors());
?>
If you want to force SSL connection only then remove novalidate-cert from above script.