can't send any mail as of today

Help
bleh
2009-06-16
2013-05-21
  • bleh
    bleh
    2009-06-16

    Hello,

    I am having trouble, just recently today, using the latest cvs version of libgmail. 

    I am getting:

    Password:

    Please wait, logging in...
    Log in successful.

    [u'1', 0, u'Please try again.', u'0', 0, [], 0, 0, 0, u'', 0, [], []]
    Traceback (most recent call last):
      File "quickSendTest2.py", line 57, in <module>
        if ga.sendMessage(gmsg):
      File "/home/socialh/nigra_pack/newlibgmail/libgmail.py", line 628, in sendMessage
        raise GmailSendError, resultInfo[SM_MSG]
    libgmail.GmailSendError: Please try again.
    socialh@host2:~/nigra_pack/newlibgmail$

    using the sendmailtest from the demos folder from the latest cvs release.  I also tried the libgmailtests.py stuff too, and got the same result.  I can login accounts fine and read messages, but I can not send.

     
    • Same problem for me. I had an old libgmail version (0.1.6) I upgraded to the 0.1.11 and the problem still exists.

       
    • rhauer
      rhauer
      2009-06-18

      This is because cookie GMAIL_AT is missing. There is a problem in the redirection.
      I fixed it editing the cookies library. I use ClientCookie, but same fix should work using Mechanize (not tested):

      1. Open your _http.py (Mechanize) or _urllib2_support.py (ClientCookie)

      2. Go to function "http_error_302", and after these 3 lines...:
              new = self.redirect_request(newurl, req, fp, code, msg, headers)
              if new is None:
                  return
          ...add these 4 lines:
              try:
                  self.cookiejar.extract_cookies(fp,new)
              except NameError:
                  pass

      3. Save the file and try libgmail.
          It is just a solution, I suppose there is a smarter way to do it :).

      PS: Note that "cookiejar" may not exist. In our case (libgmail), it exists in our "SmartRedirectHandler".

       
      • John  Haggerty
        John Haggerty
        2009-08-15

        "This is because cookie GMAIL_AT is missing. There is a problem in the redirection.
        I fixed it editing the cookies library. I use ClientCookie, but same fix should work using Mechanize (not tested):

        1. Open your _http.py (Mechanize) or _urllib2_support.py (ClientCookie)

        2. Go to function "http_error_302", and after these 3 lines...:
        new = self.redirect_request(newurl, req, fp, code, msg, headers)
        if new is None:
        return
        ...add these 4 lines:
        try:
        self.cookiejar.extract_cookies(fp,new)
        except NameError:
        pass

        3. Save the file and try libgmail.
        It is just a solution, I suppose there is a smarter way to do it :).

        PS: Note that "cookiejar" may not exist. In our case (libgmail), it exists in our "SmartRedirectHandler".
        "

        I did exactly that and I didn't find any relief appended that code to _http.py for mechanize and still got basically the same error

        owner@bouncyinc:~/Downloads/libgmail-docs_0.3$ ./sendmsg.py nameofaccount nameofaccount@gmail.com "I like sleeping" "sleeping is nice and fun"
        Password:

        Please wait, logging in...
        Log in successful.

        Traceback (most recent call last):
          File "./sendmsg.py", line 57, in <module>
            if ga.sendMessage(gmsg):
          File "/usr/lib/python2.5/site-packages/libgmail.py", line 615, in sendMessage
            raise GmailSendError, resultInfo[SM_MSG]
        libgmail.GmailSendError: Please try again.

        Yeah still broken 2x months later and then we have another poster actively asking no one to use the code that 5x projects use to get access to gmail.

        I'm past mad :(

         
        • bleh
          bleh
          2009-08-15

          you gotta get rid of "debuglevel" at the bottom of gmail_transport.py

          its in two spots at the bottom of the file, in both the bottom methods:

          so...
          ClientCookie.HTTPHandler.__init__(self, debuglevel)

          to....
          ClientCookie.HTTPHandler.__init__(self)

          do the same thing for:

          ClientCookie.HTTPSHandler.__init__(self, debuglevel)

          to

          ClientCookie.HTTPSHandler.__init__(self)

          I submitted this but i guess it was never patched to cvs.

          no more name errors. :)   Email me if you're still having trouble:  zkinion@gmail.com.  I have some other stuff written as well that makes things easier. 

          Good luck.

           
    • I use mechanize and making the suggested modifications worked like a charm!

      thank you very much

       
    • rainwolf8472
      rainwolf8472
      2009-06-19

      I can confirm that the fix works for regular accounts, but not for gmail for domains.

       
    • bleh
      bleh
      2009-06-20

      I can also confirm that this fix works, but for some reason 1.11 does not work with proxies at all (gmail transport).

        File "<MY DIR>/libgmail.py", line 335, in login
          pageData = self._retrievePage(req)
        File "<MY DIR>/libgmail.py", line 385, in _retrievePage
          resp = self.opener.open(req)
        File "/usr/lib/python2.5/site-packages/mechanize/_opener.py", line 181, in open
          response = urlopen(self, req, data)
        File "/usr/lib/python2.5/urllib2.py", line 399, in _open
          '_open', req)
        File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
          result = func(*args)
        File "/usr/lib/python2.5/site-packages/mechanize/_http.py", line 727, in https_open
          key_file, cert_file = self.client_cert_manager.find_key_cert(
      AttributeError: 'int' object has no attribute 'find_key_cert'

      I will make a new thread since this seems more like an issue with 1.11 rather than the current issue...

       
    • rhauer
      rhauer
      2009-06-20

      rainwolf8472, I don't see any problem sending messages with a domain for gmail using that fix... although I have just tried one domain.

       
    • rainwolf8472
      rainwolf8472
      2009-06-20

      strange, using testlibgmail.py (and my own implementation), I consistently get the following error

      ======================================================================
      ERROR: test_send_and_receive_mail (__main__.LibgmailTests)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "C:\Documents and Settings\rainwolf\Desktop\testlibgmail.py", line 54, in
      test_send_and_receive_mail
          output = account.sendMessage(msg)
        File "C:\Python25\lib\site-packages\libgmail.py", line 605, in sendMessage
          items = self._parsePage(req)
        File "C:\Python25\lib\site-packages\libgmail.py", line 365, in _parsePage
          items = _parsePage(self._retrievePage(urlOrRequest))
        File "C:\Python25\lib\site-packages\libgmail.py", line 99, in _parsePage
          raise GmailError, 'Failed to parse data returned from gmail.'
      GmailError: Failed to parse data returned from gmail.

      ----------------------------------------------------------------------
      Ran 2 tests in 2.469s

      FAILED (errors=1)