(self, s)
Send `s' to the server.
Send `s' to the server.
Send s to the server .
def send(self, s):
        """Send `s' to the server."""
        if self.debuglevel > 0:
            self._print_debug('send:', repr(s))
        if self.sock:
            if isinstance(s, str):
                # send is used by the 'data' command, where command_encoding
                # should not be used, but 'data' needs to convert the string to
                # binary itself anyway, so that's not a problem.
                s = s.encode(self.command_encoding)
            sys.audit("smtplib.send", self, s)
            try:
                self.sock.sendall(s)
            except OSError:
                self.close()
                raise SMTPServerDisconnected('Server not connected')
        else:
            raise SMTPServerDisconnected('please run connect() first')
def send ( self , s ) : if self . debuglevel > 0 : self . _print_debug ( 'send:' , repr ( s ) ) if self . sock : if isinstance ( s , str ) : # send is used by the 'data' command, where command_encoding # should not be used, but 'data' needs to convert the string to # binary itself anyway, so that's not a problem. s = s . encode ( self . command_encoding ) sys . audit ( "smtplib.send" , self , s ) try : self . sock . sendall ( s ) except OSError : self . close ( ) raise SMTPServerDisconnected ( 'Server not connected' ) else : raise SMTPServerDisconnected ( 'please run connect() first' )