Note that there are some explanatory texts on larger screens.

plurals
  1. POPython - Imap Gmail Response
    text
    copied!<p>I am programming a simple IMAP client for gmail. As it is an assignment to use sockets and so on, i cannot use python's imaplib library. I encountered a problem within this code:</p> <pre><code> def connect(self, server, username, password, port=993): self.socket.connect((server, port)) response = self.socket.recv(2048) if response.startswith('NO' or 'BAD'): return False print response # send username self.sendData('a001 login {0} {1}\n'.format(username, password)) response = self.socket.recv(2048) if response.startswith('NO' or 'BAD'): return False print response self.sendData('a002 CAPABILITY\n') response = self.socket.recv(2048) if response.startswith('NO' or 'BAD'): print response return False print response return True </code></pre> <p>Everything works fine, until the second command to be sent. I'm not really sure, what i am in now. </p> <p>Here is sendData which was asked:</p> <pre><code> def sendData(self, command): lenght = len(command) totalSendBytes = 0 while (totalSendBytes &lt; lenght): bytesSend = self.socket.send(command[totalSendBytes:]) if bytesSend &lt;= 0: return False totalSendBytes += bytesSend return True </code></pre> <p>After launching the program, i get response only to first command :</p> <blockquote> <ul> <li><p>OK Gimap ready for requests from IPGOESHERE 47if12049394eef.11</p></li> <li><p>CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE a001 OK xxx@gmail.com XXX XXX authenticated (Success)</p></li> </ul> </blockquote> <p>Thank you in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload