diff options
author | R David Murray <rdmurray@bitdance.com> | 2015-05-17 23:27:22 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2015-05-17 23:27:22 (GMT) |
commit | 8308444eefee8a6b5bb58b9f51a29d1a8d3683bf (patch) | |
tree | dd907f25915c28b10af8b14901ab2a90687576a7 /Doc | |
parent | 740d6134f15cd9641a7c9d953269a07a99d02a2b (diff) | |
download | cpython-8308444eefee8a6b5bb58b9f51a29d1a8d3683bf.zip cpython-8308444eefee8a6b5bb58b9f51a29d1a8d3683bf.tar.gz cpython-8308444eefee8a6b5bb58b9f51a29d1a8d3683bf.tar.bz2 |
#24218: Add SMTPUTF8 support to send_message.
Reviewed by Maciej Szulik.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/smtplib.rst | 12 | ||||
-rw-r--r-- | Doc/whatsnew/3.5.rst | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 133fa56..25279f2 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -467,7 +467,7 @@ An :class:`SMTP` instance has the following methods: If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills those arguments with addresses extracted from the headers of *msg* as - specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` + specified in :rfc:`5322`\: *from_addr* is set to the :mailheader:`Sender` field if it is present, and otherwise to the :mailheader:`From` field. *to_adresses* combines the values (if any) of the :mailheader:`To`, :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one @@ -482,10 +482,18 @@ An :class:`SMTP` instance has the following methods: calls :meth:`sendmail` to transmit the resulting message. Regardless of the values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear - in *msg*. + in *msg*. If any of the addresses in *from_addr* and *to_addrs* contain + non-ASCII characters and the server does not advertise ``SMTPUTF8`` support, + an :exc:`SMTPNotSupported` error is raised. Otherwise the ``Message`` is + serialized with a clone of its :mod:`~email.policy` with the + :attr:`~email.policy.EmailPolicy.utf8` attribute set to ``True``, and + ``SMTPUTF8`` and ``BODY=8BITMIME`` are added to *mail_options*. .. versionadded:: 3.2 + .. versionadded:: 3.5 + Support for internationalized addresses (``SMTPUTF8``). + .. method:: SMTP.quit() diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index 1f8d90f..762ad22 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -557,8 +557,10 @@ smtplib :class:`smtplib.SMTP`. (Contributed by Gavin Chappell and Maciej Szulik in :issue:`16914`.) -* :mod:`smtplib` now support :rfc:`6531` (SMTPUTF8). (Contributed by - Milan Oberkirch and R. David Murray in :issue:`22027`.) +* :mod:`smtplib` now supports :rfc:`6531` (SMTPUTF8) in both the + :meth:`~smtplib.SMTP.sendmail` and :meth:`~smtplib.SMTP.send_message` + commands. (Contributed by Milan Oberkirch and R. David Murray in + :issue:`22027`.) sndhdr ------ |