Skip to content

Conversation

@matrixise
Copy link
Member

@matrixise matrixise commented Jan 30, 2018

Avoid to set the SMTPUTF8 flag when the sender name contains a non-ascii
character. Patch by Stéphane Wirtel

https://bugs.python.org/issue32727

Copy link
Member

@bitdancer bitdancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test, as you know :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Do not include name field in SMTP envelope from address."

Lib/smtplib.py Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SInce there's only one, you don't need the list comprehension:

from_addr = email.utils.getaddresses([from_addr])[0][1]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitdancer about your solution, I like it and that was my first solution, but I was thinking about one thing, I didn't see in the code an section where you have this kind of access to the item [0][1] but if you agree with that, I am going to fix it.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name this "test_name_field_not_included_in_envelope_addresses", and check the addresses seen by the server. That means changing SimSMTPServer's process_message method to record the from and to addresses so you can check them in the test method.

…addr and to_addrs

Avoid to set the SMTPUTF8 flag when the sender name contains a non-ascii
character. Patch by Stéphane Wirtel
@matrixise
Copy link
Member Author

matrixise commented Jan 30, 2018 via email

@bedevere-bot
Copy link

@bitdancer: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @matrixise for the PR, and @bitdancer for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 31, 2018
…addr and to_addrs (pythonGH-5451)

Do not pass the name field in the 'from' address in the SMTP envelope.
(cherry picked from commit 8d83e4b)

Co-authored-by: Stéphane Wirtel <[email protected]>
@bedevere-bot
Copy link

GH-5455 is a backport of this pull request to the 3.6 branch.

bitdancer pushed a commit that referenced this pull request Jan 31, 2018
…addr and to_addrs (GH-5451) (#5455)

Do not pass the name field in the 'from' address in the SMTP envelope.
(cherry picked from commit 8d83e4b)

Co-authored-by: Stéphane Wirtel <[email protected]>
ned-deily pushed a commit to ned-deily/cpython that referenced this pull request Jan 31, 2018
…addr and to_addrs (python#5451)

Do not pass the name field in the 'from' address in the SMTP envelope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants