问题
I'm integrating auto reply mail for unread messages in my cpanel webmail/roundcube/squirrelmail. See my code below here. The problem is i'm facing imap_open function is could not connected. It's loading can't through any error/ exception too still loading. Any one guide me. I'm looking forward for your reply. Also check my code is this correct or not.
$emailAddress = 'info@example.com'; // Full email address
$emailPassword = 'xxxxxxxx'; // Email password
$domainURL = 'example.com'; // Your websites domain
$useHTTPS = false;
/* BEGIN MESSAGE COUNT CODE */
$inbox = imap_open('{'.$domainURL.':143/notls}INBOX',$emailAddress,$emailPassword) or die('Cannot connect to domain:' . imap_last_error());
$oResult = imap_search($inbox, 'UNSEEN');
if(empty($oResult))
$nMsgCount = 0;
else
$nMsgCount = count($oResult);
imap_close($inbox);
echo('<p>You have '.$nMsgCount.' unread messages.</p>');
来源:https://stackoverflow.com/questions/30617992/how-to-get-inbox-messages-from-cpanel-webmail-using-php-imap-functions