Gmail 3-legged OAuth access — Zend_Mail_Protocol_E

2019-06-14 17:42发布

I'm trying to access Gmail by using three-legged Oauth PHP code provided by Google ('google-mail-xoauth-tools') here: http://code.google.com/apis/gmail/oauth/code.html. I have my domain registered and everything seems to go fine with OAuth, but after I authorize access I get this error:

Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message
'cannot connect to host; error = Connection refused (errno = 111 )'
     in /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php:100
Stack trace: #0 /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php(61):           
                  Zend_Mail_Protocol_Imap->connect('imap.gmail.com', '993', true)
             #1 /home/tchaymor/public_html/gmail/three-legged.php(170):
                  Zend_Mail_Protocol_Imap->__construct('imap.gmail.com', '993', true)
             #2 {main} thrown in /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php on line 100 

This is my first time using OAuth with any Google products, so it could be something totally brainless I'm missing. Any suggestions would be most welcome (as suggestions for easier alternatives). I'm more on the designer rather than coder end, so the simpler the better.

1条回答
够拽才男人
2楼-- · 2019-06-14 18:28

Effectively, this is failing:

fsockopen('ssl://imap.gmail.com', 993);

Several options:
1) The error would suggest google is actively blocking you, perhaps you have tested & failed a bit to much, and just have to wait untill a temporary blockade is lifted.
2) The error would be different, but just to be sure: allow_url_fopen is enabled?
3) Local firewall? (What does a telnet imap.gmail.com 993 from the server give you?)
4) Broken OpenSLL libraries are also possible, try to connect a valid https site: fsockopen("ssl://google.com",443,$errno,$errstr) or die($errstr);

查看更多
登录 后发表回答