[New-bugs-announce] [issue29860] smtplib.py doesn't capitalize EHLO.
Lord Anton Hvornum
report at bugs.python.org
Mon Mar 20 10:32:53 EDT 2017
New submission from Lord Anton Hvornum:
```
File "mail.py", line 9, in <module>
smtp_server.starttls(context)
File "/usr/lib/python3.6/smtplib.py", line 748, in starttls
self.ehlo_or_helo_if_needed()
File "/usr/lib/python3.6/smtplib.py", line 600, in ehlo_or_helo_if_needed
(code, resp) = self.helo()
File "/usr/lib/python3.6/smtplib.py", line 429, in helo
(code, msg) = self.getreply()
File "/usr/lib/python3.6/smtplib.py", line 393, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
```
This happens due to the server expecting commands (like EHLO, STARTTLS) being strict upper-case. And when the SMTP command isn't, it drops us.
This is a rare edge case since most mail servers handles shady client data in numerous different ways (such as gmail never sending QUIT for instance).
I don't know of a work-around for this and the documentation states `EHLO` is being sent (https://docs.python.org/3/library/smtplib.html), so I guess the lib assumes that's the case as well.
----------
components: Library (Lib)
messages: 289886
nosy: Lord Anton Hvornum
priority: normal
severity: normal
status: open
title: smtplib.py doesn't capitalize EHLO.
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29860>
_______________________________________
More information about the New-bugs-announce
mailing list