parameters: (self, name='')
return_statement: return (code, msg)
docstring: SMTP 'ehlo' command.
          Hostname to send for this command defaults to the FQDN of the local
          host.
docstring_summary: SMTP 'ehlo' command.
          Hostname to send for this command defaults to the FQDN of the local
          host.
docstring_tokens: SMTP ehlo command . Hostname to send for this command defaults to the FQDN of the local host .
function: def ehlo(self, name=''):
          """ SMTP 'ehlo' command.
          Hostname to send for this command defaults to the FQDN of the local
          host.
          """
          self.esmtp_features = {}
          self.putcmd(self.ehlo_msg, name or self.local_hostname)
          (code, msg) = self.getreply()
          # According to RFC1869 some (badly written)
          # MTA's will disconnect on an ehlo. Toss an exception if
          # that happens -ddm
          if code == -1 and len(msg) == 0:
              self.close()
              raise SMTPServerDisconnected("Server not connected")
          self.ehlo_resp = msg
          if code != 250:
              return (code, msg)
          self.does_esmtp = 1
          #parse the ehlo response -ddm
          resp = self.ehlo_resp.split('\n')
          del resp[0]
          for each in resp:
              # To be able to communicate with as many SMTP servers as possible,
              # we have to take the old-style auth advertisement into account,
              # because:
              # 1) Else our SMTP feature parser gets confused.
              # 2) There are some servers that only advertise the auth methods we
              #    support using the old style.
              auth_match = OLDSTYLE_AUTH.match(each)
              if auth_match:
                  # This doesn't remove duplicates, but that's no problem
                  self.esmtp_features["auth"] = self.esmtp_features.get("auth", "") \
                          + " " + auth_match.groups(0)[0]
                  continue
  
              # RFC 1869 requires a space between ehlo keyword and parameters.
              # It's actually stricter, in that only spaces are allowed between
              # parameters, but were not going to check for that here.  Note
              # that the space isn't present if there are no parameters.
              m = re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?', each)
              if m:
                  feature = m.group("feature").lower()
                  params = m.string[m.end("feature"):].strip()
                  if feature == "auth":
                      self.esmtp_features[feature] = self.esmtp_features.get(feature, "") \
                              + " " + params
                  else:
                      self.esmtp_features[feature] = params
          return (code, msg)
function_tokens: def ehlo ( self , name = '' ) : self . esmtp_features = { } self . putcmd ( self . ehlo_msg , name or self . local_hostname ) ( code , msg ) = self . getreply ( ) # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -ddm if code == - 1 and len ( msg ) == 0 : self . close ( ) raise SMTPServerDisconnected ( "Server not connected" ) self . ehlo_resp = msg if code != 250 : return ( code , msg ) self . does_esmtp = 1 #parse the ehlo response -ddm resp = self . ehlo_resp . split ( '\n' ) del resp [ 0 ] for each in resp : # To be able to communicate with as many SMTP servers as possible, # we have to take the old-style auth advertisement into account, # because: # 1) Else our SMTP feature parser gets confused. # 2) There are some servers that only advertise the auth methods we #    support using the old style. auth_match = OLDSTYLE_AUTH . match ( each ) if auth_match : # This doesn't remove duplicates, but that's no problem self . esmtp_features [ "auth" ] = self . esmtp_features . get ( "auth" , "" ) + " " + auth_match . groups ( 0 ) [ 0 ] continue # RFC 1869 requires a space between ehlo keyword and parameters. # It's actually stricter, in that only spaces are allowed between # parameters, but were not going to check for that here.  Note # that the space isn't present if there are no parameters. m = re . match ( r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?' , each ) if m : feature = m . group ( "feature" ) . lower ( ) params = m . string [ m . end ( "feature" ) : ] . strip ( ) if feature == "auth" : self . esmtp_features [ feature ] = self . esmtp_features . get ( feature , "" ) + " " + params else : self . esmtp_features [ feature ] = params return ( code , msg )