Skip to content

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

Open
middagj wants to merge 1 commit into
python:mainfrom
middagj:fix-32803-lmap-multi-data
Open

middagj wants to merge 1 commit into
python:mainfrom
middagj:fix-32803-lmap-multi-data

Conversation

@middagj

@middagj middagj commented Mar 10, 2020 •

Copy link
Copy Markdown

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

bedevere-app Bot commented Nov 2, 2023

Copy link
Copy Markdown

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
@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
@middagj
middagj force-pushed the fix-32803-lmap-multi-data branch from 34a7ae0 to d6997bb Compare March 25, 2025 10:25
@middagj

middagj commented Mar 25, 2025

Copy link
Copy Markdown
Author

@picnixz what is missing to get this PR merged at some point in time?

@picnixz

picnixz commented Mar 28, 2025

Copy link
Copy Markdown
Member

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!

@picnixz
picnixz self-requested a review March 28, 2025 12:43

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

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

@picnixz

picnixz commented Apr 19, 2025 •

Copy link
Copy Markdown
Member

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)

@middagj
middagj force-pushed the fix-32803-lmap-multi-data branch from d6997bb to 607ffa2 Compare September 1, 2025 06:32
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2026
@middagj
middagj force-pushed the fix-32803-lmap-multi-data branch from 607ffa2 to 700f408 Compare April 7, 2026 20:18
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 10, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 11, 2026
@middagj
middagj force-pushed the fix-32803-lmap-multi-data branch from 700f408 to 6acc267 Compare August 27, 2026 04:44
@middagj

middagj commented Aug 27, 2026

Copy link
Copy Markdown
Author

I don't think this is a new feature. LMTP support is documented in the documentation for many years and the DATA command is broken in the case of multiple RCTP due to the protocol difference between SMTP and LMTP for this scenario.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 31, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Nov 30, 2026
…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.
@middagj
middagj force-pushed the fix-32803-lmap-multi-data branch from 6acc267 to c583ee4 Compare November 30, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants