-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-76984: Handle DATA correctly for LMTP with multiple RCPT #18896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5afbc30
to
a6a358d
Compare
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
1c8c94a
to
eaa7e88
Compare
eaa7e88
to
1bf8b36
Compare
1bf8b36
to
e064a83
Compare
…o-32803) Conform RFC 2033, the LMTP protocol gives for each successful recipient a reply. The smtplib only reads one. This gives problems sending more than one message with multiple recipients in a connection.
34a7ae0
to
d6997bb
Compare
@picnixz what is missing to get this PR merged at some point in time? |
I just changed the title of the PR as it was against bpo IDs (which were moved to GH issues 3y ago I think) so I didn't look at it. I can have a look at that PR and review it though! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll need to review more carefully this but, assuming that this is a new feature and not just a bugfix:
- This will need a What's New entry.
- The docs need some updates (if we're documenting exceptions for instance, we also need to add this new exception to the docs)
I'd treat this as a new feature as it's a behavioral change but I need to get the context and the RFC before that so this is just a preliminary review
Oh and if @bitdancer has time, they can have a look at this one before me since they are more knowledgable (I don't have much time for email and http related stuff now) |
Conform RFC 2033, the LMTP protocol gives for each successful recipient a reply.
The smtplib only reads one. This gives problems sending more than one message
with multiple recipients in a connection. See https://bugs.python.org/issue32803
To be backwards compatible, I added a new method
multi_data
to support aDATA
command with multiple replies. I modeled it afterdata
and wanted to keep the error handling in thesendmail
method. Because we need to close the connection once we receive a 421, I chose to yield the results instead of returning a list. Similar to the multiple RCTP solution, I only raise an Exception if all recipients fail.I am not sure about the naming of
LMTPDataError
. It breaks the structure of all errors beginning with LMTP, but it is really a specific LMTP error. An alternative could beSMTPMultiDataError
.I also fixed the assertion in
test_421_from_data_cmd
. I think it should comparerset_count
and notrcpt_count
. Thercpt_count
is only modified ifrcpt_response
is used. The purpose of the test is to be sure the method closed instead of reset.https://bugs.python.org/issue32803