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

Class SMTP

Lib/smtplib.py:197–1011  ·  view source on GitHub ↗

This class manages a connection to an SMTP or ESMTP server. SMTP Objects: SMTP objects have the following attributes: helo_resp This is the message given by the server in response to the most recent HELO command. ehlo_resp

Source from the content-addressed store, hash-verified

195
196
197class SMTP:
198 """This class manages a connection to an SMTP or ESMTP server.
199 SMTP Objects:
200 SMTP objects have the following attributes:
201 helo_resp
202 This is the message given by the server in response to the
203 most recent HELO command.
204
205 ehlo_resp
206 This is the message given by the server in response to the
207 most recent EHLO command. This is usually multiline.
208
209 does_esmtp
210 This is a True value _after you do an EHLO command_, if the
211 server supports ESMTP.
212
213 esmtp_features
214 This is a dictionary, which, if the server supports ESMTP,
215 will _after you do an EHLO command_, contain the names of the
216 SMTP service extensions this server supports, and their
217 parameters (if any).
218
219 Note, all extension names are mapped to lower case in the
220 dictionary.
221
222 See each method's docstrings for details. In general, there is a
223 method of the same name to perform each SMTP command. There is also a
224 method called 'sendmail' that will do an entire mail transaction.
225 """
226 debuglevel = 0
227
228 sock = None
229 file = None
230 helo_resp = None
231 ehlo_msg = "ehlo"
232 ehlo_resp = None
233 does_esmtp = False
234 default_port = SMTP_PORT
235
236 def __init__(self, host='', port=0, local_hostname=None,
237 timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
238 source_address=None):
239 """Initialize a new instance.
240
241 If specified, `host` is the name of the remote host to which to
242 connect. If specified, `port` specifies the port to which to connect.
243 By default, smtplib.SMTP_PORT is used. If a host is specified the
244 connect method is called, and if it returns anything other than a
245 success code an SMTPConnectError is raised. If specified,
246 `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
247 command. Otherwise, the local hostname is found using
248 socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
249 port) for the socket to bind to as its source address before
250 connecting. If the host is '' and port is 0, the OS default behavior
251 will be used.
252
253 """
254 self._host = host

Callers 1

smtplib.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…