Skip to content

Commit b047074

Browse files
committed
Send another EHLO after starting TLS, as suggested by RFC 2487.
I might argue this is a bug in smtplib; RFC 2487 says that the client "MUST discard any knowledge obtained from the server, such as the list of SMTP service extensions, which was not obtained from the TLS negotiation itself" - Legacy-Id: 958
1 parent a649c85 commit b047074

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ietf/utils/mail.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def send_smtp(msg):
4545
(retval, retmsg) = server.starttls()
4646
if retval != 220:
4747
raise ImproperlyConfigured('password configured but tls failed: %d %s' % ( retval, retmsg ))
48+
# Send a new EHLO, since without TLS the server might not
49+
# advertise the AUTH capability.
50+
server.ehlo()
4851
server.login(settings.EMAIL_HOST_USER, settings.EMAIL_HOST_PASSWORD)
4952
server.sendmail(frm, to, msg.as_string())
5053
# note: should pay attention to the return code, as it may

0 commit comments

Comments
 (0)