Skip to content

gh-85642: Reset SMTP greeting state when establishing a new connection - #159343

Open
esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-11-smtp-reconnect-state
Open

esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-11-smtp-reconnect-state

Conversation

@esadomer

@esadomer esadomer commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Reusing an SMTP or LMTP instance can retain the previous connection's greeting and ESMTP capabilities, preventing the new server from being greeted. Clear that state after socket establishment and before reading the greeting. Cover SMTP, TCP LMTP, Unix-socket LMTP, and connection/greeting failures.

Fixes #85642.

Validation (Windows debug build): test_smtplib passed (88 tests run, 1 skipped); reconnect, socket-failure, and greeting-failure cases were exercised with mocked sockets. The isolated patch applies cleanly to the base revision.

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.SMTP should reset internal 'helo' and 'ehlo' state within 'connect()'

1 participant