【问题标题】:GMAIL IMAP read fails due to authentication when used in bitbucket pipeline在 bitbucket 管道中使用时,由于身份验证导致 GMAIL IMAP 读取失败
【发布时间】:2018-03-20 08:24:43
【问题描述】:

当我在由 bitbucket 管道运行的 docker 容器中运行脚本时,此调用 (imap_open()) 一直失败。

PHP 警告:imap_open():无法在 /opt/atlassian/pipelines/agent/build/test/tools/plib 中打开流 {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX /confirm.php 在第 24 行 PHP 致命错误:在 /opt/atlassian/pipelines/agent/build/test/tools/plib/signup.php:24 中带有消息“注册:确认失败”的未捕获异常“异常” 堆栈跟踪: #0 /opt/atlassian/pipelines/agent/build/test/tools/test.php(51): 注册(数组) #1 {主要} 在第 24 行抛出 /opt/atlassian/pipelines/agent/build/test/tools/plib/signup.php PHP 通知:未知:在 [ALERT] 后重试 PLAIN 身份验证请通过 Web 浏览器登录:https://support.google.com/mail/acco (errflg=1) 在第 0 行的未知中 PHP 通知:未知:在 [ALERT] 后重试 PLAIN 身份验证请通过 Web 浏览器登录:https://support.google.com/mail/acco (errflg=1) 在第 0 行的未知 PHP 通知:未知:无法对 IMAP 服务器进行身份验证:[ALERT] 请通过 Web 浏览器登录:https://support.google.com/mail/acco (errflg=2) 在第 0 行的未知中 无法连接到 Gmail:无法对​​ IMAP 服务器进行身份验证:[ALERT] 请通过您的网络浏览器登录:https://support.google.com/mail/acco

我已遵循所有这些说明:

  1. 启用安全性较低的应用
  2. https://accounts.google.com/b/0/DisplayUnlockCaptcha启用
  3. 尝试使用和不使用 /novalidate-cert 标志

相同的脚本在 Mac OS 或什至 AWS EC2 实例中本地运行时工作正常,但在由 bitbucket 或 Heroku 运行时失败。我无法在这些实例上运行浏览器,因此无法尝试 Web 界面,显然一旦启用访问,它应该可以在任何地方工作。

太糟糕了,错误消息中的链接甚至都不完整。

知道如何克服这个问题吗?我要做的只是以编程方式简单地模拟点击注册电子邮件中的验证链接。

【问题讨论】:

    标签: gmail containers bitbucket imap bitbucket-pipelines


    【解决方案1】:

    如前所述,谷歌确实会提醒“安全性较低的应用程序”,即使在此之后,身份验证也会失败。 此处最好的解决方案是转向 OAUTH2 身份验证方法,否则即使您找到解决此“安全性较低的警报”问题的方法......它最终可能会在将来发生和关闭。

    【讨论】:

    • 谢谢 - 能够使用 OAUTH2 api 并实现我想要的
    猜你喜欢
    • 2018-02-25
    • 2020-12-03
    • 2017-03-30
    • 2013-02-06
    • 2012-01-29
    • 2015-03-13
    • 2017-08-16
    • 2016-05-20
    • 2017-01-27
    相关资源
    最近更新 更多