This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: send_message should take all the addresses in the To: header into account
Type: Stage: test needed
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: barry, kirelagin, r.david.murray
Priority: normal Keywords: patch

Created on 2015-04-27 21:26 by kirelagin, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
multiple_to.patch kirelagin, 2015-04-28 06:35 review
multiple_fields_test.patch kirelagin, 2015-05-02 08:11 review
Messages (7)
msg242158 - (view) Author: Kirill Elagin (kirelagin) Date: 2015-04-27 21:26
If I have a message with multiple `To` headers and I send it using `send_message` not specifying `to_addrs`, the message gets sent only to one of the recipients.

I’m attaching my patch that makes it send to _all_ the addresses listed in `To`, `Cc` and `Bcc`.

I didn’t add any new tests as the existing ones already cover those cases and I have no idea how on Earth do they pass.
msg242163 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-04-28 01:44
Kirill, the patch is missing.
msg242167 - (view) Author: Kirill Elagin (kirelagin) Date: 2015-04-28 06:35
msg242361 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-02 00:46
Can you write a test that shows the failure?  There is an existing test that demonstrates sending to multiple addresses (testSendMessageWithAddresses), so you must have found an edge case that isn't tested.  (Either that, or the existing test is broken.)
msg242385 - (view) Author: Kirill Elagin (kirelagin) Date: 2015-05-02 08:11
Ah, I’m so dumb. Of course the tests work as there are multiple addresses but still just one field.

Here is the test for multiple fields.
msg242394 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-02 12:39
Ah, but that is intentional.  Those fields can only appear once per message, per the RFC.  The new email API will raise an error if you attempt to add them more than once.  Perhaps we should raise an error instead of ignoring the duplicates, given that we are actively inspecting those headers.
msg242396 - (view) Author: Kirill Elagin (kirelagin) Date: 2015-05-02 13:04
Oh, I see now.

It is a good idea to raise an error either in `send_message` or at the moment when a second `To`/`Cc`/`Bcc` header is added to the message.
Date User Action Args
2022-04-11 14:58:16adminsetgithub: 68254
2015-05-02 13:04:06kirelaginsetstatus: open -> closed
resolution: not a bug
messages: + msg242396
2015-05-02 12:39:56r.david.murraysetmessages: + msg242394
2015-05-02 08:11:38kirelaginsetfiles: + multiple_fields_test.patch

messages: + msg242385
2015-05-02 00:46:05r.david.murraysetmessages: + msg242361
stage: patch review -> test needed
2015-04-28 06:47:47ned.deilysetnosy: + barry, r.david.murray, - ned.deily
stage: patch review

versions: + Python 3.5
2015-04-28 06:35:11kirelaginsetfiles: + multiple_to.patch
keywords: + patch
messages: + msg242167
2015-04-28 01:44:05ned.deilysetnosy: + ned.deily
messages: + msg242163
2015-04-27 21:26:12kirelagincreate