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

Method _deliver

Lib/test/support/smtpd.py:747–769  ·  view source on GitHub ↗
(self, mailfrom, rcpttos, data)

Source from the content-addressed store, hash-verified

745 print('we got some refusals:', refused, file=DEBUGSTREAM)
746
747 def _deliver(self, mailfrom, rcpttos, data):
748 import smtplib
749 refused = {}
750 try:
751 s = smtplib.SMTP()
752 s.connect(self._remoteaddr[0], self._remoteaddr[1])
753 try:
754 refused = s.sendmail(mailfrom, rcpttos, data)
755 finally:
756 s.quit()
757 except smtplib.SMTPRecipientsRefused as e:
758 print('got SMTPRecipientsRefused', file=DEBUGSTREAM)
759 refused = e.recipients
760 except (OSError, smtplib.SMTPException) as e:
761 print('got', e.__class__, file=DEBUGSTREAM)
762 # All recipients were refused. If the exception had an associated
763 # error code, use it. Otherwise,fake it with a non-triggering
764 # exception code.
765 errcode = getattr(e, 'smtp_code', -1)
766 errmsg = getattr(e, 'smtp_error', 'ignore')
767 for r in rcpttos:
768 refused[r] = (errcode, errmsg)
769 return refused
770
771
772class Options:

Callers 1

process_messageMethod · 0.95

Calls 3

connectMethod · 0.95
sendmailMethod · 0.95
quitMethod · 0.95

Tested by

no test coverage detected