This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fixes smtplib starttls HELO errors
Type: Stage:
Components: Library (Lib) Versions: Python 2.4, Python 2.3, Python 2.6, Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: fenner, gregory.p.smith, jdcrunchman, loewis
Priority: normal Keywords: patch

Created on 2003-10-25 02:49 by jdcrunchman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib jdcrunchman, 2003-10-25 02:49 smtplib.py.patch
smtplib-startls-discard-knowledge.diff fenner, 2007-10-30 17:53
Messages (6)
msg44827 - (view) Author: John Draper (jdcrunchman) Date: 2003-10-25 02:49
smtplib.starttls() needs to include does_esmtp=0. Without 
this, the "size=" suffix on MAIL FROM lines causes server 
errors since the MTA defaults to HELO mode. This is also 
necessary in order to conform to RFC 2487 section 5.2, 
which states after TLS is started, all prior knowledge 
(including esmtp capability) must be discarded.

This bug exists in Python 2.3.2 and earlier.
msg44828 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-10-31 15:48
Logged In: YES 
user_id=21627

Shouldn't you also reset other state, such as esmtp_features?
msg56828 - (view) Author: Bill Fenner (fenner) Date: 2007-10-26 23:18
Yes, the state that should be reset includes helo_resp, ehlo_resp, 
esmtp_features, and does_esmtp.

The workaround commonly proposed is to always call ehlo() after starttls() 
.  While this works (most of the time?), it seems arbitrary to require an 
explicit ehlo() call in this case but not other cases.
msg56967 - (view) Author: Bill Fenner (fenner) Date: 2007-10-30 17:53
I've attached an updated diff, against the 2.4.3 smtplib.py, which forgets 
all of the relevant pieces of information.  The line numbers are offset 
from the standard lib because the original file has my patch for issue 
1339 applied, but there is no overlap so this patch should apply cleanly.
msg60020 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-01-17 07:44
Fixed in trunk (2.6) r60015.
msg60021 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-01-17 07:55
and in r60017 on release25-maint for inclusion in 2.5.2.
History
Date User Action Args
2022-04-11 14:56:00adminsetgithub: 39456
2008-01-17 07:55:19gregory.p.smithsetmessages: + msg60021
2008-01-17 07:44:21gregory.p.smithsetstatus: open -> closed
resolution: accepted
messages: + msg60020
versions: + Python 2.6, Python 2.5
2008-01-17 02:07:47gregory.p.smithsetassignee: gregory.p.smith
2008-01-17 02:06:51gregory.p.smithsetnosy: + gregory.p.smith
2007-10-30 17:53:43fennersetfiles: + smtplib-startls-discard-knowledge.diff
messages: + msg56967
2007-10-26 23:18:28fennersetnosy: + fenner
messages: + msg56828
versions: + Python 2.4
2003-10-25 02:49:54jdcrunchmancreate