I'm trying to fetching email from particular email account. Code is working fine when i'm passing correct details in the imap_open();
function. But i want to add validation, when someone pass incorrect email address or password then it should return error. I followed the instruction of this up-voted answer but it doesn't work.
$mbox = imap_open("{mail.example.com.com:143/novalidate-cert}", "dev@example.com", "wrongPassWord");
// Check if imap connect or not
if($mbox){
echo 'connect';
}else{
echo 'Not connect';
}
imap_close($mbox);
Also when i add wrong detail then it returning warning errors.
Can anyone guide me regarding this how can i check if imap_open() connect or not and prevent the warning errors, that i can fix this issue. I would like to appreciate if someone guide me. Thank You.