php - imap_open 很长的延迟
问题描述
我们使用以下代码通过 SSL 连接到 IMAP:
imap_timeout(IMAP_OPENTIMEOUT, 5);
imap_timeout(IMAP_READTIMEOUT, 5);
imap_timeout(IMAP_WRITETIMEOUT, 5);
imap_timeout(IMAP_CLOSETIMEOUT, 5);
$connection = null;
try {
$connection = imap_open('{'.$host.':'.$port.'/service='.$service.$crypt.'/novalidate-cert}', $user, $pass, OP_SILENT, 1, array('DISABLE_AUTHENTICATOR' => 'PLAIN'));
} catch (Exception $e) {
// Errors logged in a summary below
}
这通常没有任何问题。但是,有时它会在 imap_open 上挂起超过 800 秒。它返回的错误是:
TLS\/SSL failure for imap.xxx.net: SSL negotiation failed
如何确保 imap_open 不会等待这么久?
解决方案
推荐阅读
- mysql - 如何在 MySQL 中使用准备好的语句创建动态列?
- spring - Spring启动多个数据源以在没有@Qualifier的情况下调用相同的服务
- javascript - 如何在节点js中阻止来自其他域的请求
- visual-studio-code - 如何在 Visual Studio 代码中关闭保存时的文本格式?
- python - Django 测试:AttributeError:'Client' 对象没有属性'get'
- r - 如何读取字段中包含逗号的列的 csv 文件?
- ssh - SSH 不适用于思科集成多业务路由器
- flutter - Chewie颤动视频播放器
- ruby-on-rails - 从 babel-Loader 中排除 node_modules 的正确方法是什么?在 Rails/webpacker 中
- python - 限制用户输入非数值