當我在由bitbucket流水線運行的docker容器內運行腳本時,此調用(imap_open())一直失敗。GMAIL在bitbucket流水線中使用時,由於身份驗證,IMAP讀取失敗
PHP Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX in /opt/atlassian/pipelines/agent/build/test/tools/plib/confirm.php on line 24 PHP Fatal error: Uncaught exception 'Exception' with message 'signup: confirm failed' in /opt/atlassian/pipelines/agent/build/test/tools/plib/signup.php:24 Stack trace: #0 /opt/atlassian/pipelines/agent/build/test/tools/test.php(51): signup(Array) #1 {main} thrown in /opt/atlassian/pipelines/agent/build/test/tools/plib/signup.php on line 24 PHP Notice: Unknown: Retrying PLAIN authentication after [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=1) in Unknown on line 0 PHP Notice: Unknown: Retrying PLAIN authentication after [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=1) in Unknown on line 0 PHP Notice: Unknown: Can not authenticate to IMAP server: [ALERT] Please log in via your web browser: https://support.google.com/mail/acco (errflg=2) in Unknown on line 0 Cannot connect to Gmail: Can not authenticate to IMAP server: [ALERT] Please log in via your web browser: https://support.google.com/mail/acco
我按照所有這些指令:
- 啓用不夠安全的應用
- 從https://accounts.google.com/b/0/DisplayUnlockCaptcha
- 啓用嘗試使用和不使用/ NOVALIDATE證書標誌
相同的腳本在Mac OS甚至使用AWS EC2實例在本地運行時工作良好,但在失敗時失敗由bitbucket或Heroku運行。我無法在這些實例上運行瀏覽器,因此無法嘗試使用Web界面,並且顯然一旦啓用訪問權限,它就應該在每個位置工作。
太糟糕了,錯誤信息中的鏈接甚至不完整。
任何想法如何克服這一點?我想要做的只是以編程方式簡單模擬註冊電子郵件中的驗證鏈接。
謝謝 - 能夠使用OAUTH2 API並實現我想要的 – srvy