我正在使用whm并使用gmail
为Gmail设置的安全性较低的应用
在gmail中启用了imap
我在代码点火器中有以下代码作为cron作业,每10分钟运行一次。
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<table>
<thead>
<tr>
<th>Day</th>
<th>Note</th>
<th>Accumulate</th>
</tr>
</thead>
<tbody data-bind="foreach: items">
<tr>
<td data-bind="text: day"></td>
<td data-bind="text: note"></td>
<td data-bind="text: acc"></td>
</tr>
</tbody>
</table>
它给了我这个错误:
Filename: cs/cron.php, line number: 237, I have:
$conn = imap_open("{imap.gmail.com:993/imap/ssl}Hub Service Updates", "test@test.com", "password", OP_READONLY) or die('Cannot connect to Gmail: ' . imap_last_error());
$imc = imap_check($conn);
$totalMessage = $imc->Nmsgs;
我在同一个whm服务器的终端中运行此脚本,它正在运行。 var_dump能够输出正确的信息。
A PHP Error was encountered
Severity: Warning
Message: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}Hub Service Updates
Filename: cs/cron.php
Line Number: 237
Cannot connect to Gmail: [CLOSED] IMAP connection broken (server response)
A PHP Error was encountered
Severity: Notice
Message: Unknown: [CLOSED] IMAP connection broken (server response) (errflg=2)
Filename: Unknown
Line Number: 0
的var_dump
<?php
$conn = imap_open("{imap.gmail.com:993/imap/ssl}Hub Service Updates", "test@test.com", "passowrd", OP_READONLY)
or die('Cannot connect to Gmail: ' . imap_last_error());
$imc = imap_check($conn);
$totalMessage = $imc->Nmsgs;
var_dump($imc);
var_dump($totalMessage);