0

问题是我正在尝试使用 php 从我的电子邮件中获取最后一封电子邮件,并且它在本地运行良好。但后来我把脚本上传到客户端的服务器,每次都拒绝。日志显示:

[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 显示:

证书失败:服务器名称与证书不匹配:/OU=Domain Control Validated/OU=Hosted by HostGator.com, LLC./OU=PositiveSSL Wildcard/CN=*.hostclear.com"

我再说一遍,它在本地工作,但我在实时服务器上得到它。这可能是什么原因造成的?

这是代码:

$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);
4

0 回答 0