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

Method data

Lib/smtplib.py:563–590  ·  view source on GitHub ↗

SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. Raises SMTPDataError if there is an unexpected reply to the DATA command; the return value from this method is the final response code received when th

(self, msg)

Source from the content-addressed store, hash-verified

561 return self.getreply()
562
563 def data(self, msg):
564 """SMTP 'DATA' command -- sends message data to server.
565
566 Automatically quotes lines beginning with a period per rfc821.
567 Raises SMTPDataError if there is an unexpected reply to the
568 DATA command; the return value from this method is the final
569 response code received when the all data is sent. If msg
570 is a string, lone '\\r' and '\\n' characters are converted to
571 '\\r\\n' characters. If msg is bytes, it is transmitted as is.
572 """
573 self.putcmd("data")
574 (code, repl) = self.getreply()
575 if self.debuglevel > 0:
576 self._print_debug('data:', (code, repl))
577 if code != 354:
578 raise SMTPDataError(code, repl)
579 else:
580 if isinstance(msg, str):
581 msg = _fix_eols(msg).encode('ascii')
582 q = _quote_periods(msg)
583 if q[-2:] != bCRLF:
584 q = q + bCRLF
585 q = q + b"." + bCRLF
586 self.send(q)
587 (code, msg) = self.getreply()
588 if self.debuglevel > 0:
589 self._print_debug('data:', (code, msg))
590 return (code, msg)
591
592 def verify(self, address):
593 """SMTP 'verify' command -- checks for address validity."""

Callers 3

sendmailMethod · 0.95
rtd_switcher.jsFile · 0.45

Calls 8

putcmdMethod · 0.95
getreplyMethod · 0.95
_print_debugMethod · 0.95
sendMethod · 0.95
SMTPDataErrorClass · 0.85
_fix_eolsFunction · 0.85
_quote_periodsFunction · 0.85
encodeMethod · 0.45