parameters: (self)
return_statement: return errcode, errmsg
docstring: Get a reply from the server.
  
          Returns a tuple consisting of:
  
            - server response code (e.g. '250', or such, if all goes well)
              Note: returns -1 if it can't read response code.
  
            - server response string corresponding to response code (multiline
              responses are converted to a single, multiline string).
  
          Raises SMTPServerDisconnected if end-of-file is reached.
docstring_summary: Get a reply from the server.
docstring_tokens: Get a reply from the server .
function: def getreply(self):
          """Get a reply from the server.
  
          Returns a tuple consisting of:
  
            - server response code (e.g. '250', or such, if all goes well)
              Note: returns -1 if it can't read response code.
  
            - server response string corresponding to response code (multiline
              responses are converted to a single, multiline string).
  
          Raises SMTPServerDisconnected if end-of-file is reached.
          """
          resp = []
          if self.file is None:
              self.file = self.sock.makefile('rb')
          while 1:
              try:
                  line = self.file.readline()
              except socket.error as e:
                  self.close()
                  raise SMTPServerDisconnected("Connection unexpectedly closed: "
                                               + str(e))
              if line == '':
                  self.close()
                  raise SMTPServerDisconnected("Connection unexpectedly closed")
              if self.debuglevel > 0:
                  print>>stderr, 'reply:', repr(line)
              resp.append(line[4:].strip())
              code = line[:3]
              # Check that the error code is syntactically correct.
              # Don't attempt to read a continuation line if it is broken.
              try:
                  errcode = int(code)
              except ValueError:
                  errcode = -1
                  break
              # Check if multiline response.
              if line[3:4] != "-":
                  break
  
          errmsg = "\n".join(resp)
          if self.debuglevel > 0:
              print>>stderr, 'reply: retcode (%s); Msg: %s' % (errcode, errmsg)
          return errcode, errmsg
function_tokens: def getreply ( self ) : resp = [ ] if self . file is None : self . file = self . sock . makefile ( 'rb' ) while 1 : try : line = self . file . readline ( ) except socket . error as e : self . close ( ) raise SMTPServerDisconnected ( "Connection unexpectedly closed: " + str ( e ) ) if line == '' : self . close ( ) raise SMTPServerDisconnected ( "Connection unexpectedly closed" ) if self . debuglevel > 0 : print >> stderr , 'reply:' , repr ( line ) resp . append ( line [ 4 : ] . strip ( ) ) code = line [ : 3 ] # Check that the error code is syntactically correct. # Don't attempt to read a continuation line if it is broken. try : errcode = int ( code ) except ValueError : errcode = - 1 break # Check if multiline response. if line [ 3 : 4 ] != "-" : break errmsg = "\n" . join ( resp ) if self . debuglevel > 0 : print >> stderr , 'reply: retcode (%s); Msg: %s' % ( errcode , errmsg ) return errcode , errmsg