Skip to content

Commit c740c99

Browse files
Doc: Clarify smtplib server reply bytes
1 parent acefff9 commit c740c99

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Doc/library/smtplib.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ A nice selection of exceptions is defined as well:
168168

169169
.. attribute:: smtp_error
170170

171-
The error message.
171+
The error message as a :class:`bytes` object.
172172

173173

174174
.. exception:: SMTPSenderRefused
@@ -323,9 +323,11 @@ An :class:`SMTP` instance has the following methods:
323323
.. method:: SMTP.verify(address)
324324

325325
Check the validity of an address on this server using SMTP ``VRFY``. Returns a
326-
tuple consisting of code 250 and a full :rfc:`822` address (including human
327-
name) if the user address is valid. Otherwise returns an SMTP error code of 400
328-
or greater and an error string.
326+
``(code, message)`` tuple, where *message* is the server response as a
327+
:class:`bytes` object. If the user address is valid, *code* is 250 and
328+
*message* contains a full :rfc:`822` address (including human name).
329+
Otherwise *code* is an SMTP error code of 400 or greater and *message*
330+
contains the error response.
329331

330332
.. note::
331333

@@ -485,8 +487,9 @@ An :class:`SMTP` instance has the following methods:
485487
recipient. Otherwise it will raise an exception. That is, if this method does
486488
not raise an exception, then someone should get your mail. If this method does
487489
not raise an exception, it returns a dictionary, with one entry for each
488-
recipient that was refused. Each entry contains a tuple of the SMTP error code
489-
and the accompanying error message sent by the server.
490+
recipient that was refused. Each entry contains a ``(code, response)`` tuple,
491+
where *code* is the SMTP error code and *response* is the accompanying server
492+
error response as a :class:`bytes` object.
490493

491494
If ``SMTPUTF8`` is included in *mail_options*, and the server supports it,
492495
*from_addr* and *to_addrs* may contain non-ASCII characters.

0 commit comments

Comments
 (0)