Skip to content

Commit 65451a6

Browse files
committed
Clarify host and port parameter behavior in smtplib.SMTP_SSL initialization
1 parent 158b28d commit 65451a6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/library/smtplib.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
2626
An :class:`SMTP` instance encapsulates an SMTP connection. It has methods
2727
that support a full repertoire of SMTP and ESMTP operations. If the optional
2828
*host* and *port* parameters are given, the SMTP :meth:`connect` method is
29-
called with those parameters during initialization. If specified,
29+
called with those parameters during initialization.If *host* is omitted or
30+
an empty string, no connection is made during initialization; you must
31+
call :meth:`connect` manually before using the instance.
32+
If *port* is zero, the default SMTP port (25) is used. If specified,
3033
*local_hostname* is used as the FQDN of the local host in the HELO/EHLO
3134
command. Otherwise, the local hostname is found using
3235
:func:`socket.getfqdn`. If the :meth:`connect` call returns anything other
@@ -81,7 +84,10 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
8184
An :class:`SMTP_SSL` instance behaves exactly the same as instances of
8285
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
8386
required from the beginning of the connection and using :meth:`starttls` is
84-
not appropriate. If *host* is not specified, the local host is used. If
87+
not appropriate. If the optional *host* and *port* parameters are given, the
88+
SMTP_SSL :meth:`connect` method is called with those parameters during initialization.
89+
If *host* is omitted or an empty string, no connection is made during initialization;
90+
you must call :meth:`connect` manually before using the instance. If
8591
*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional
8692
arguments *local_hostname*, *timeout* and *source_address* have the same
8793
meaning as they do in the :class:`SMTP` class. *context*, also optional,

0 commit comments

Comments
 (0)