[Python-bugs-list] SMTPLIB bug with STARTTLS

Python Bugs python-bugs@shopip.com
Sat, 28 Jun 2003 21:39:11 -0700 (PDT)


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. Patch follows:


--- /usr/local/lib/python2.3/smtplib.py.orig	Sat Apr 12 09:54:24 2003
+++ /usr/local/lib/python2.3/smtplib.py	Sat Jun 28 12:38:12 2003
@@ -597,6 +597,7 @@
             sslobj = socket.ssl(self.sock, keyfile, certfile)
             self.sock = SSLFakeSocket(self.sock, sslobj)
             self.file = SSLFakeFile(sslobj)
+            self.does_esmtp=0 #RFC 2487 sec. 5.2 compliance
         return (resp, reply)

     def sendmail(self, from_addr, to_addrs, msg, mail_options=[],