0

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);
Dave
  • 5,108
  • 16
  • 30
  • 40
F_Bass
  • 343
  • 4
  • 17
  • Does this answer your question? [Certificate error using IMAP in PHP](https://stackoverflow.com/questions/7891729/certificate-error-using-imap-in-php) – mitkosoft Feb 14 '20 at 11:40
  • @mitkosoft unfortunately it doesn't – F_Bass Feb 14 '20 at 12:49
  • Your error message does not match your code: [12-Feb-2020 08:43:21 location] PHP Warning: imap_open(): Couldn't open stream {:***143***/imap}INBOX in /path/triggerCall.php on line 2 – Max Feb 14 '20 at 14:52
  • That error is shown in the logs. The error i get with imap_errors() is: 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" – F_Bass Feb 15 '20 at 16:33

0 Answers0