summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-06-23 19:52:08 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-06-23 19:52:08 (GMT)
commitec94eac4c9390b8dc656c110d775c3e33cf6c93a (patch)
tree2b972b6ff8d073c37ce3aa3599dbc3ffa9958b50 /Doc
parent5707d508e1b589045ce1062da3497ad9653f1cf6 (diff)
parent36beb66be9110c06b69c8b81c3fe286042d2d962 (diff)
downloadcpython-ec94eac4c9390b8dc656c110d775c3e33cf6c93a.zip
cpython-ec94eac4c9390b8dc656c110d775c3e33cf6c93a.tar.gz
cpython-ec94eac4c9390b8dc656c110d775c3e33cf6c93a.tar.bz2
Merge #18179: document the local_hostname parameter.
Original patch by Berker Peksag.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/smtplib.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst
index 5762bb6..f2b49d5 100644
--- a/Doc/library/smtplib.rst
+++ b/Doc/library/smtplib.rst
@@ -25,7 +25,10 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
A :class:`SMTP` instance encapsulates an SMTP connection. It has methods
that support a full repertoire of SMTP and ESMTP operations. If the optional
host and port parameters are given, the SMTP :meth:`connect` method is called
- with those parameters during initialization. If the :meth:`connect` call
+ with those parameters during initialization. If specified, *local_hostname* is
+ used as the FQDN of the local host in the HELO/EHLO command. Otherwise, the
+ local hostname is found using :func:`socket.getfqdn`. If the
+ :meth:`connect` call
returns anything other than a success code, an :exc:`SMTPConnectError` is
raised. The optional *timeout* parameter specifies a timeout in seconds for
blocking operations like the connection attempt (if not specified, the
@@ -57,13 +60,17 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
.. versionchanged:: 3.3
source_address argument was added.
-.. class:: SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None[, timeout], context=None, source_address=None)
+.. class:: SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, \
+ certfile=None [, timeout], context=None, \
+ source_address=None)
A :class:`SMTP_SSL` instance behaves exactly the same as instances of
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
required from the beginning of the connection and using :meth:`starttls` is
not appropriate. If *host* is not specified, the local host is used. If
- *port* is zero, the standard SMTP-over-SSL port (465) is used. *keyfile*
+ *port* is zero, the standard SMTP-over-SSL port (465) is used. The optional
+ arguments *local_hostname* and *source_address* have the same meaning as
+ they do in the :class:`SMTP` class. *keyfile*
and *certfile* are also optional, and can contain a PEM formatted private key
and certificate chain file for the SSL connection. *context* also optional, can contain
a SSLContext, and is an alternative to keyfile and certfile; If it is specified both
@@ -90,7 +97,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
standard SMTP client. It's common to use Unix sockets for LMTP, so our
:meth:`connect` method must support that as well as a regular host:port
server. The optional arguments local_hostname and source_address have the
- same meaning as that of SMTP client. To specify a Unix socket, you must use
+ same meaning as they do in the :class:`SMTP` class. To specify a Unix socket, you must use
an absolute path for *host*, starting with a '/'.
Authentication is supported, using the regular SMTP mechanism. When using a Unix