gh-73065: Add Date header if missing in smtplib send_message#136850
gh-73065: Add Date header if missing in smtplib send_message#136850Yoav11 wants to merge 15 commits into
Conversation
|
Please change the title to use the GitHub issue number. |
|
@Yoav11 A little suggestion, when you complete a suggestion, whether that be by implementing it or providing a reason why you are not going to, please mark the conversation as "Resolved," this keeps the PR more organized. |
ilovelinux
left a comment
There was a problem hiding this comment.
Consider mocking the date with a non-UTC time of which we know the timezone
|
Please do not use the Update Branch button unless necessary (e.g. fixing conflicts, jogging the CI, or very old PRs) as it uses valuable resources. For more information see the devguide. |
|
@StanFromIreland the PR should be ready to be merged |
|
@StanFromIreland bump 🙂 |
|
The email experts have been requested, please be patient. |
|
Thanks for the update 🙂 |
|
This PR is stale because it has been open for 30 days with no activity. |
zware
left a comment
There was a problem hiding this comment.
Overall LGTM with an optional cleanup nit and a question.
| raise ValueError("message has more than one 'Resent-' header block") | ||
|
|
||
| # RFC 5322 section 3.6, 4th Paragraph | ||
| if msg.get('Date', None) is None: |
There was a problem hiding this comment.
Naive question: would it make any sense for a user to have explicitly set msg['Date'] = None? Should we instead check 'Date' in msg?
There was a problem hiding this comment.
Hum, I would assume that if you want "Date" to appear but without anything that you would set it to an empty string ("") and not 'None'.
Setting it to None doesn't make sense to me as this is the value on default argument to say "it might not be passed through".
However, i agree that it would be safer.
| timeout=support.LOOPBACK_TIMEOUT) | ||
| self.addCleanup(smtp.close) | ||
| self.assertEqual(smtp.send_message(msg), {}) | ||
| """.format(date)) |
There was a problem hiding this comment.
Nit: I think it would be fine to go with an f-string here.
There was a problem hiding this comment.
I did this back in 2017 i think... f-string didn't exist 😆.
Description
this PR was created during EuroPython 2025 Sprint Weekend.
It builds on #5176 authored by @elafontaine
📚 Documentation preview 📚: https://cpython-previews--136850.org.readthedocs.build/