The issue is i'm trying to get the last email from my email using php, and it works fine locally. But then I uploaded the script to the client's server, and It's refusing every time. The logs show this:
[12-Feb-2020 08:43:21 location] PHP Warning: imap_open(): Couldn't open stream {<mail>:143/imap}INBOX in /path/triggerCall.php on line 2
[12-Feb-2020 08:43:21 location] PHP Warning: imap_headers() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 7
[12-Feb-2020 08:43:21 location] PHP Warning: imap_num_msg() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 14
[12-Feb-2020 08:43:21 location] PHP Warning: imap_header() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 16
[12-Feb-2020 08:43:21 location] PHP Warning: imap_fetchbody() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 20
[12-Feb-2020 08:43:21 location] PHP Warning: imap_close() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 40
imap_errors show this:
Certificate failure for : Server name does not match certificate: /OU=Domain Control Validated/OU=Hosted by HostGator.com, LLC./OU=PositiveSSL Wildcard/CN=*.hostclear.com"
I repeat, it works locally, but i get this on the live server. What could be causing this?
This is the code:
$inbox = imap_open('{<mail>:993/imap}', '<username>', '<password>');
$headers = imap_headers($inbox);
$last = imap_num_msg($inbox);
$header = imap_header($inbox, $last);
$body = imap_fetchbody($inbox, $last,1);