Skip to content
Open
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions Doc/library/smtplib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
An :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 specified,
called with those parameters during initialization.If *host* is omitted or
Copy link
Member

@picnixz picnixz Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already hinted in the previous sentence and this would somehow conflict with the last sentence IMO.

If the optional host and port parameters are given, the SMTP :meth:connect method is called with those parameters during initialization

an empty string, no connection is made during initialization; you must
call :meth:`connect` manually before using the instance.
If *port* is zero, the default SMTP port (25) is used. If specified,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not always the case that the default SMTP port is 25. It depends on the default_port attribute. Also, this now contradicts the last sentence:

If omitted (or if host or port are '' and/or 0
respectively) the OS default behavior will be used.

We should also make more paragraphs. This description is too compact for the reader.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If port is zero, the value of the instance's default_port attribute will be used.

I'd appreciate any insights or suggestions to expand our descriptions so that its not too compact for reader

*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 +81,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 84 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 84 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 84 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