PHP Classes

Gmail error

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Gmail error  >  (Un) Subscribe thread alerts  
Subject:Gmail error
Summary:connection is not in AUTHORIZATION state error on Login
Messages:7
Author:Sreenath K Pillai
Date:2008-01-18 20:40:35
Update:2008-01-22 01:39:15
 

  1. Gmail error   Reply   Report abuse  
Picture of Sreenath K Pillai Sreenath K Pillai - 2008-01-18 20:40:35
"connection is not in AUTHORIZATION state" is the error string returned by the Login function. I copied your entire class and below it had these lines of code:
$pop3=new pop3_class;
$pop3->hostname="pop.gmail.com";
$pop3->port=995;
$pop3->tls=1;
$user="correctusername@gmail.com";
$password="correctpassword";
$pop3->realm="";
$pop3->workstation="";
$apop=0;
$pop3->authentication_mechanism="USER";
$pop3->debug=1;
$pop3->html_debug=1;
$pop3->join_continuation_header_lines=1;
echo $pop3->Login($user,$password,$apop);
$nummsg;
$tsize;
$pop3->Statistics($nummsg,$tsize);
echo $nummsg." ".$tsize;

  2. Re: Gmail error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-01-18 21:05:20 - In reply to message 1 from Sreenath K Pillai
You need to call the Connect() function before you call Login().

  3. Re: Gmail error   Reply   Report abuse  
Picture of Sreenath K Pillai Sreenath K Pillai - 2008-01-19 16:46:35 - In reply to message 2 from Manuel Lemos
Thank you for your help Mr. Lemos,

in your test script all it shows before login() is open() not connect. anyway, I just took your test script and changed variables to correct values and it said connecting... COULD NOT CONNECT.

is this because outgoing traffic on port 995 is restricted by my webhost? I hope so, because then it will work on my webserver at work.

thanks again! using fsockopen to access POP3 is the best solution there is, as the imap_xxx functions were not working for me.

  4. Re: Gmail error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-01-19 18:57:54 - In reply to message 3 from Sreenath K Pillai
Yes, depending on the error, it may be caused by your ISP blocking port 995.

  5. Re: Gmail error   Reply   Report abuse  
Picture of Sreenath K Pillai Sreenath K Pillai - 2008-01-22 00:56:28 - In reply to message 4 from Manuel Lemos
146.151.47.55/test_pop3.php

what happens now is that it times out. This time, I took your test_pop3.php script and used these values:
$pop3=new pop3_class;
$pop3->hostname="pop.gmail.com";
$pop3->port=995;
$pop3->tls=0;
$user="-----------"; //valid@gmail.com
$password="-----"; //validpass
$pop3->realm="";
$pop3->workstation="";
$apop=0;
$pop3->authentication_mechanism="USER";
$pop3->debug=1;
$pop3->html_debug=1;
$pop3->join_continuation_header_lines=1;
didnt do anything else. the test pop3 i assumed the rest of it to work, just configured the few values above.

"Connecting to pop.gmail.com ...

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\pop3.php on line 79"

is what comes up. you can verify this with the link. why is this? This is on a server I set up and it doesnt even have a firewall at all yet! so it can't be 995 blockage. as you can see, other pages work just fine in this server http://146.151.47.55/phpinfo.php

  6. Re: Gmail error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-01-22 01:25:49 - In reply to message 5 from Sreenath K Pillai
You need to set the tls variable to 1 because Google only accepts secure connections.

  7. Re: Gmail error   Reply   Report abuse  
Picture of Sreenath K Pillai Sreenath K Pillai - 2008-01-22 01:39:15 - In reply to message 6 from Manuel Lemos
wow i'm dumb.

thank you