Lines Matching full:smtp
1 :mod:`smtplib` --- SMTP protocol client
5 :synopsis: SMTP protocol client (requires sockets).
10 pair: SMTP; protocol
17 The :mod:`smtplib` module defines an SMTP client session object that can be used
18 to send mail to any Internet machine with an SMTP or ESMTP listener daemon. For
19 details of SMTP and ESMTP operation, consult :rfc:`821` (Simple Mail Transfer
20 Protocol) and :rfc:`1869` (SMTP Service Extensions).
23 .. class:: SMTP([host[, port[, local_hostname[, timeout]]]])
25 An :class:`SMTP` instance encapsulates an SMTP connection. It has methods
26 that support a full repertoire of SMTP and ESMTP operations. If the optional
27 host and port parameters are given, the SMTP :meth:`connect` method is
49 :class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
52 *port* is omitted, the standard SMTP-over-SSL port (465) is used.
53 *local_hostname* has the same meaning as it does for the :class:`SMTP`
67 standard SMTP client. It's common to use Unix sockets for LMTP, so our
70 :class:`SMTP` class. To specify a Unix socket, you must use an absolute
73 Authentication is supported, using the regular SMTP mechanism. When using a
91 attempt is made to use the :class:`SMTP` instance before connecting it to a
97 Base class for all exceptions that include an SMTP error code. These exceptions
98 are generated in some instances when the SMTP server returns an error code. The
107 the SMTP server refused.
114 same sort as :meth:`SMTP.sendmail` returns.
119 The SMTP server refused to accept the message data.
134 SMTP authentication went wrong. Most probably the server didn't accept the
141 Protocol definition for SMTP. This document covers the model, operating
142 procedure, and protocol details for SMTP.
144 :rfc:`1869` - SMTP Service Extensions
145 Definition of the ESMTP extensions for SMTP. This describes a framework for
146 extending SMTP with new commands, supporting dynamic discovery of the commands
152 SMTP Objects
155 An :class:`SMTP` instance has the following methods:
158 .. method:: SMTP.set_debuglevel(level)
164 .. method:: SMTP.docmd(cmd, [, argstring])
180 .. method:: SMTP.connect([host[, port]])
183 host at the standard SMTP port (25). If the hostname ends with a colon (``':'``)
191 .. method:: SMTP.helo([hostname])
193 Identify yourself to the SMTP server using ``HELO``. The hostname argument
202 .. method:: SMTP.ehlo([hostname])
211 SMTP service extensions this server supports, and their
218 .. method:: SMTP.ehlo_or_helo_if_needed()
229 .. method:: SMTP.has_extn(name)
231 Return :const:`True` if *name* is in the set of SMTP service extensions returned
235 .. method:: SMTP.verify(address)
237 Check the validity of an address on this server using SMTP ``VRFY``. Returns a
239 name) if the user address is valid. Otherwise returns an SMTP error code of 400
244 Many sites disable SMTP ``VRFY`` in order to foil spammers.
247 .. method:: SMTP.login(user, password)
249 Log in on an SMTP server that requires authentication. The arguments are the
265 .. method:: SMTP.starttls([keyfile[, certfile]])
267 Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP
291 .. method:: SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])
305 envelope used by the transport agents. The :class:`SMTP` does not modify the
318 recipient that was refused. Each entry contains a tuple of the SMTP error code
343 .. method:: SMTP.quit()
345 Terminate the SMTP session and close the connection. Return the result of
346 the SMTP ``QUIT`` command.
352 Low-level methods corresponding to the standard SMTP/ESMTP commands ``HELP``,
360 SMTP Example
392 server = smtplib.SMTP('localhost')