#26487: Use EHLO after smtplib.SMTP_SSL too.
--------------------------------------+------------------------------------
     Reporter:  kchmiela              |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Core (Mail)           |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  1                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by timgraham):

 * needs_tests:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 The ticket is missing the rationale of what problem is being solved. Is it
 to detect communication failures in `open()` rather than wait until
 sending a message? Maybe `ehlo_or_helo_if_needed()` should be used
 instead?
 {{{ #!diff
 diff --git a/django/core/mail/backends/smtp.py
 b/django/core/mail/backends/smtp.py
 index 432f3a6..40778eb 100644
 --- a/django/core/mail/backends/smtp.py
 +++ b/django/core/mail/backends/smtp.py
 @@ -56,13 +56,12 @@ class EmailBackend(BaseEmailBackend):
              })
          try:
              self.connection = connection_class(self.host, self.port,
 **connection_params)
 +            self.connection.ehlo_or_helo_if_needed()

              # TLS/SSL are mutually exclusive, so only attempt TLS over
              # non-secure connections.
              if not self.use_ssl and self.use_tls:
 -                self.connection.ehlo()
                  self.connection.starttls(keyfile=self.ssl_keyfile,
 certfile=self.ssl_certfile)
 -                self.connection.ehlo()
              if self.username and self.password:
                  self.connection.login(self.username, self.password)
              return True
 }}}
 Anyway, tests are still needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/26487#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.e0c50b711167ea5b3610cd164d796c3d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to