php - imap gmail中的DDeboer连接失败
问题描述
我需要一些有关 lib DDeboer-Imap 的帮助。我无法连接到 Gmail 帐户,我已经完成了我在互联网上找到的所有可能设置,包括在帐户上启用 imap、启用不太安全的应用程序、禁用任何不正常的活动,但这些都不起作用,我有同样的反馈:
错误响应:
[ERROR] Error: [E_WARNING] Authentication failed for user "xxxxxxx@gmail.com":
imap_open(): Couldn't open stream
{imap.gmail.com:993/imap/ssl/validate-cert}
imap_alerts (0):
imap_errors (1):
- Can not authenticate to IMAP server: [ALERT] Please log in via your
web browser: https://support.google.com/mail/acco
php 版本是 7.2,所有库都处于活动状态,imap、openssl 和我验证过的其他库都是必需的,正如所说,没有任何东西可以连接帐户。
我也尝试过更改为不使用 SSL 进行连接,但没有成功。
以下是我的代码的摘录。
try {
foreach ($mailboxes as $key => $mailbox) {
$hostname = 'custom' == $mailbox['server'] ? $mailbox['imap'] : $mailbox['server'];
$cert = 143 == $mailbox['port'] ? '/imap/novalidate-cert' : '/imap/ssl/validate-cert';
$server = new Server($hostname, $mailbox['port'], $cert);
$connection = $server->authenticate($mailbox['email'], $mailbox['password']);
$this->readMailboxes($connection, $mailbox);
}
} catch (Exception $e) {
throw new Exception($e->getMessage(), 1);
}
谢谢!!!!
解决方案
推荐阅读
- python - 为什么 pandas 0.25.3 中的多索引排序这么慢
- web-scraping - 使用 puppeteer 优化网页抓取
- pine-script - 您好,如何在平仓后存储值“Strategy.position_avg_price”
- reactjs - 错误:对象作为 React 子对象无效(找到:带有键 {_id} 的对象)。如果您打算渲染一组孩子,请改用数组
- php - 如何在 PHP7 环境中的 Google App Engine Flexible 中将 HTTP 重定向到 HTTPS?
- elasticsearch - Jenkins logstash 插件 data.buildDuration 总是 0
- javascript - 未捕获的类型错误:无法读取未定义的属性“状态”-React.js
- c# - 使用 ASP.NET Core 3.1,如何从页面 URL 中剥离 Home 控制器?
- python - 组织一个未腌制的文件python
- json - 在哈巴狗做一个迭代并给它一个限制