MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / SMTP

Class SMTP

tools/python-3.11.9-amd64/Lib/smtplib.py:190–1010  ·  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

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

Callers 1

smtplib.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected