Skip to content
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

gh-76984: Handle DATA correctly for LMTP with multiple RCPT #18896

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

middagj
Copy link

@middagj middagj commented Mar 10, 2020

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 a DATA command with multiple replies. I modeled it after data and wanted to keep the error handling in the sendmail 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 be SMTPMultiDataError.

I also fixed the assertion in test_421_from_data_cmd. I think it should compare rset_count and not rcpt_count. The rcpt_count is only modified if rcpt_response is used. The purpose of the test is to be sure the method closed instead of reset.

https://bugs.python.org/issue32803

@bedevere-app
Copy link

bedevere-app bot commented Nov 2, 2023

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 skip news label instead.

@middagj middagj force-pushed the fix-32803-lmap-multi-data branch 3 times, most recently from 1c8c94a to eaa7e88 Compare November 2, 2023 17:37
@middagj middagj force-pushed the fix-32803-lmap-multi-data branch from eaa7e88 to 1bf8b36 Compare January 19, 2024 13:20
…H-76984)

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.
@middagj middagj force-pushed the fix-32803-lmap-multi-data branch from 1bf8b36 to e064a83 Compare October 11, 2024 07:29
@picnixz picnixz changed the title bpo-32803: Handle DATA correctly for LMTP with multiple RCPT gh-76984: Handle DATA correctly for LMTP with multiple RCPT Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants