[issue33633] smtplib msg['To] = appends instead of assigning

2018-05-24 Thread R. David Murray
R. David Murray added the comment: smtplib doesn't define any behavior for messages. I presume you are talking about the email library? Vis the print behavior, dict-style lookup is defined to return the first matching header. If you want to see all of them, you can use get_all. For debugg

[issue33633] smtplib msg['To] = appends instead of assigning

2018-05-24 Thread Xavier Bonaventura
Xavier Bonaventura added the comment: I've seen that in the documentation is quite clear with it. The question would be if the print should behave different, it is quite difficult to debug if not. __setitem__(name, val) Add a header to the message with field name name and value val. The field

[issue33633] smtplib msg['To] = appends instead of assigning

2018-05-24 Thread Xavier Bonaventura
New submission from Xavier Bonaventura : The behavior when you assign an email to 'To' is counter intuitive. When you do: msg['To'] = 'f...@mail.com' this appends the email instead of really assigning it. This is because the assignment operator is overwritten. Imagine that you have code like t