]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#18179: document the local_hostname parameter.
authorR David Murray <rdmurray@bitdance.com>
Sun, 23 Jun 2013 20:02:34 +0000 (16:02 -0400)
committerR David Murray <rdmurray@bitdance.com>
Sun, 23 Jun 2013 20:02:34 +0000 (16:02 -0400)
Original patch by Berker Peksag.

Doc/library/smtplib.rst
Lib/smtplib.py

index 18560c129f791e9b825ed29932947e5641ca82b7..27d722d96a7f91a2597bad0d5a836cc2d266daee 100644 (file)
@@ -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
@@ -45,7 +48,9 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
    :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 omitted, the standard SMTP-over-SSL port (465) is used. *keyfile*
+   *port* is omitted, the standard SMTP-over-SSL port (465) is used.
+   *local_hostname* has the same meaning as it does for 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. The optional *timeout*
    parameter specifies a timeout in seconds for blocking operations like the
@@ -59,7 +64,8 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
 
    The LMTP protocol, which is very similar to ESMTP, is heavily based on the
    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. To specify a
+   method must support that as well as a regular host:port server.  *local_hostname*
+   has the same meaning as it does for 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
index a3213b33d715e54e42fec490d79759568b36501a..2c8dc42d9ebfb8e24a35332562fb2f117b58d3fb 100755 (executable)
@@ -240,7 +240,8 @@ class SMTP:
         By default, smtplib.SMTP_PORT is used.  If a host is specified the
         connect method is called, and if it returns anything other than
         a success code an SMTPConnectError is raised.  If specified,
-        `local_hostname` is used as the FQDN of the local host.  By default,
+        `local_hostname` is used as the FQDN of the local host for the
+        HELO/EHLO command.  Otherwise,
         the local hostname is found using socket.getfqdn().
 
         """
@@ -762,7 +763,8 @@ if _have_ssl:
         """ This is a subclass derived from SMTP that connects over an SSL encrypted
         socket (to use this class you need a socket module that was compiled with SSL
         support). If host is not specified, '' (the local host) is used. If port is
-        omitted, the standard SMTP-over-SSL port (465) is used. keyfile and certfile
+        omitted, the standard SMTP-over-SSL port (465) is used.  local_hostname
+        has the same meaning as it does in the SMTP class.  keyfile and certfile
         are also optional - they can contain a PEM formatted private key and
         certificate chain file for the SSL connection.
         """
@@ -797,7 +799,8 @@ class LMTP(SMTP):
     The LMTP protocol, which is very similar to ESMTP, is heavily based
     on the standard SMTP client. It's common to use Unix sockets for LMTP,
     so our connect() method must support that as well as a regular
-    host:port server. To specify a Unix socket, you must use an absolute
+    host:port server.  local_hostname has the same meaning as it does in the
+    SMTP class.  To specify a Unix socket, you must use an absolute
     path as the host, starting with a '/'.
 
     Authentication is supported, using the regular SMTP mechanism. When