MCPcopy Index your code
hub / github.com/python/cpython / send

Method send

Lib/smtplib.py:355–372  ·  view source on GitHub ↗

Send 's' to the server.

(self, s)

Source from the content-addressed store, hash-verified

353 return (code, msg)
354
355 def send(self, s):
356 """Send 's' to the server."""
357 if self.debuglevel > 0:
358 self._print_debug('send:', repr(s))
359 if self.sock:
360 if isinstance(s, str):
361 # send is used by the 'data' command, where command_encoding
362 # should not be used, but 'data' needs to convert the string to
363 # binary itself anyway, so that's not a problem.
364 s = s.encode(self.command_encoding)
365 sys.audit("smtplib.send", self, s)
366 try:
367 self.sock.sendall(s)
368 except OSError:
369 self.close()
370 raise SMTPServerDisconnected('Server not connected')
371 else:
372 raise SMTPServerDisconnected('please run connect() first')
373
374 def putcmd(self, cmd, args=""):
375 """Send a command to the server."""

Callers 3

putcmdMethod · 0.95
dataMethod · 0.95
writeMethod · 0.45

Calls 5

_print_debugMethod · 0.95
closeMethod · 0.95
encodeMethod · 0.45
sendallMethod · 0.45

Tested by

no test coverage detected