#17471: Add ability to use smtplib.SMTP_SSL connection when sending email
-----------------------------+--------------------------------------
     Reporter:  dje          |                    Owner:  nobody
         Type:  New feature  |                   Status:  new
    Component:  Core (Mail)  |                  Version:  1.3
     Severity:  Normal       |               Resolution:
     Keywords:  smtp         |             Triage Stage:  Unreviewed
    Has patch:  1            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  1
Easy pickings:  1            |                    UI/UX:  0
-----------------------------+--------------------------------------
Changes (by kmtracey):

 * needs_better_patch:   => 1
 * component:  Uncategorized => Core (Mail)
 * needs_tests:   => 0
 * needs_docs:   => 0
 * type:  Bug => New feature


Comment:

 Google's docs now say that port 465 is for SSL, while TLS/STARTTLS is 587
 (they didn't used to be that specific as to which port was for what
 protocol). What Django implements, when EMAIL_USE_TLS is True, is
 starttls. So the proper port to use for Django speaking to GMail servers,
 today, given that Django implements TLS and not SSL, is 587, not 465.

 The patch as presented can't be used in Django as is. It re-interprets
 Django's EMAIL_USE_TLS setting to mean "use an `smtplib.SMTP_SSL`
 connection". Such a connection doesn't work for servers who implement TLS,
 not SSL. For example if you use the patched code against GMail's server
 port 587 you get an exception: SSLError: (1, '_ssl.c:503:
 error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol'). So
 if we were to change the code as is done in the patch, suddenly everyone
 who had a working config talking to a TLS server would be broken.

 It seems like what is needed to talk to an SSL-implementing server (like
 GMail port 465) is yet another option (sigh) to tell the email code to use
 an `smtplib.SMTP_SSL` connection rather than doing the starttls thing.
 Note `smtplib.SMTP_SSL` is new in Python 2.6 so we cannot support this new
 type of email security except when running under Python 2.6.

 Changing this to a feature request rather than a bug, and changing the
 summary to match. It's not a bug if things don't work correctly if they've
 been misconfigured, and telling Django to use tls against an email server
 who is expecting ssl and not tls is a misconfiguration. But what we are
 missing on the Djagno side is apparently any way to do the ssl connection
 instead of TLS, and if there are common servers that implement only SSL
 and not TLS then Django likely should support talking to them.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17471#comment:1>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to