Skip to content

Commit a2e3513

Browse files
authored
Update smtplib.rst
1 parent a18843d commit a2e3513

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

Doc/library/smtplib.rst

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
8080

8181
An :class:`SMTP_SSL` instance behaves exactly the same as instances of
8282
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
83-
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
83+
required from the beginning of the connection and using :meth:`~SMTP.starttls`
84+
is not appropriate. If *host* is not specified, the local host is used. If
8585
*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional
8686
arguments *local_hostname*, *timeout* and *source_address* have the same
8787
meaning as they do in the :class:`SMTP` class. *context*, also optional,
@@ -112,7 +112,7 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
112112

113113
The LMTP protocol, which is very similar to ESMTP, is heavily based on the
114114
standard SMTP client. It's common to use Unix sockets for LMTP, so our
115-
:meth:`connect` method must support that as well as a regular host:port
115+
:meth:`~SMTP.connect` method must support that as well as a regular host:port
116116
server. The optional arguments *local_hostname* and *source_address* have the
117117
same meaning as they do in the :class:`SMTP` class. To specify a Unix
118118
socket, you must use an absolute path for *host*, starting with a '/'.
@@ -147,9 +147,15 @@ A nice selection of exceptions is defined as well:
147147
.. exception:: SMTPResponseException
148148

149149
Base class for all exceptions that include an SMTP error code. These exceptions
150-
are generated in some instances when the SMTP server returns an error code. The
151-
error code is stored in the :attr:`smtp_code` attribute of the error, and the
152-
:attr:`smtp_error` attribute is set to the error message.
150+
are generated in some instances when the SMTP server returns an error code.
151+
152+
.. attribute:: smtp_code
153+
154+
The error code.
155+
156+
.. attribute:: smtp_error
157+
158+
The error message.
153159

154160

155161
.. exception:: SMTPSenderRefused
@@ -161,9 +167,13 @@ A nice selection of exceptions is defined as well:
161167

162168
.. exception:: SMTPRecipientsRefused
163169

164-
All recipient addresses refused. The errors for each recipient are accessible
165-
through the attribute :attr:`recipients`, which is a dictionary of exactly the
166-
same sort as :meth:`SMTP.sendmail` returns.
170+
All recipient addresses refused.
171+
172+
.. attribute:: recipients
173+
174+
The errors for each recipient are accessible through this
175+
attribute, which is a dictionary of exactly thesame sort as
176+
:meth:`SMTP.sendmail` returns.
167177

168178

169179
.. exception:: SMTPDataError
@@ -211,7 +221,27 @@ A nice selection of exceptions is defined as well:
211221
SMTP Objects
212222
------------
213223

214-
An :class:`SMTP` instance has the following methods:
224+
An :class:`SMTP` instance has the following methods and attributes:
225+
226+
.. attribute:: SMTP.helo_resp
227+
228+
The response to the ``HELO`` command, see :meth:`helo`.
229+
230+
231+
.. attribute:: SMTP.ehlo_resp
232+
233+
The response to the ``EHLO`` command, see :meth:`ehlo`.
234+
235+
.. attribute:: SMTP.does_esmtp
236+
237+
A boolean value indicating whether the server supports ESMTP, see
238+
:meth:`ehlo`.
239+
240+
241+
.. attribute:: SMTP.esmtp_features
242+
243+
A dictionary of the names of SMTP service extensions supported by the server,
244+
see :meth:`ehlo`.
215245

216246

217247
.. method:: SMTP.set_debuglevel(level)
@@ -417,7 +447,7 @@ An :class:`SMTP` instance has the following methods:
417447

418448
.. versionchanged:: 3.4
419449
The method now supports hostname check with
420-
:attr:`SSLContext.check_hostname` and *Server Name Indicator* (see
450+
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indicator* (see
421451
:const:`~ssl.HAS_SNI`).
422452

423453
.. versionchanged:: 3.5
@@ -435,7 +465,7 @@ An :class:`SMTP` instance has the following methods:
435465
ESMTP options (such as ``DSN`` commands) that should be used with all ``RCPT``
436466
commands can be passed as *rcpt_options*. (If you need to use different ESMTP
437467
options to different recipients you have to use the low-level methods such as
438-
:meth:`mail`, :meth:`rcpt` and :meth:`data` to send the message.)
468+
:meth:`!mail`, :meth:`!rcpt` and :meth:`!data` to send the message.)
439469

440470
.. note::
441471

@@ -467,10 +497,12 @@ An :class:`SMTP` instance has the following methods:
467497
This method may raise the following exceptions:
468498

469499
:exc:`SMTPRecipientsRefused`
470-
All recipients were refused. Nobody got the mail. The :attr:`recipients`
471-
attribute of the exception object is a dictionary with information about the
472-
refused recipients (like the one returned when at least one recipient was
473-
accepted).
500+
All recipients were refused. Nobody got the mail.
501+
502+
.. attribute:: recipients
503+
504+
A dictionary with information about the refused recipients
505+
(like the one returned when at least one recipient was accepted).
474506

475507
:exc:`SMTPHeloError`
476508
The server didn't reply properly to the ``HELO`` greeting.

0 commit comments

Comments
 (0)