Skip to content

gh-137339: Clarify host and port parameter behavior in smtplib.SMTP_SSL initialization #137340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Doc/library/smtplib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

.. class:: SMTP(host='', port=0, local_hostname=None[, timeout], source_address=None)

An :class:`SMTP` instance encapsulates an SMTP connection. It has methods

Check warning on line 26 in Doc/library/smtplib.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:attr reference target not found: default_port [ref.attr]
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 specified,
that support a full repertoire of SMTP and ESMTP operations.
If *host* is omitted or set to an empty string, no connection is made during initialization; you must
call :meth:`connect` manually before using the instance.
If *port* is zero,the value of the :attr:`default_port` attribute is used. 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
Expand Down Expand Up @@ -78,10 +79,13 @@
.. class:: SMTP_SSL(host='', port=0, local_hostname=None, * [, timeout], \
context=None, source_address=None)

An :class:`SMTP_SSL` instance behaves exactly the same as instances of

Check warning on line 82 in Doc/library/smtplib.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: connect [ref.meth]

Check warning on line 82 in Doc/library/smtplib.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: connect [ref.meth]

Check warning on line 82 in Doc/library/smtplib.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: starttls [ref.meth]
: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
not appropriate. If the optional *host* and *port* parameters are given, the
SMTP_SSL :meth:`connect` method is called with those parameters during initialization.
If *host* is omitted or an empty string, no connection is made during initialization;
you must call :meth:`connect` manually before using the instance. If
*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional
arguments *local_hostname*, *timeout* and *source_address* have the same
meaning as they do in the :class:`SMTP` class. *context*, also optional,
Expand Down
Loading