Skip to content

gh-48392: Fix smtplib.SMTP.close() not resetting the EHLO state - #161267

Open
vasiliyk wants to merge 2 commits into
python:mainfrom
vasiliyk:gh-48392-state-reset
Open

vasiliyk wants to merge 2 commits into
python:mainfrom
vasiliyk:gh-48392-state-reset

Conversation

@vasiliyk

@vasiliyk vasiliyk commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The reset of SMTP state was only in quit(), so a session that ended in close() (with statement, a server disconnect, or quit() raising) kept the old greeting and a later connect() sent MAIL FROM without EHLO.

The reset now lives in close(), which quit() and the disconnect paths all call.

Fixes gh-48392.

Move the reset from quit() into close(), which quit() and the
disconnect paths all call.
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.

smtplib doesn't clear helo/ehlo flags on quit

1 participant