Add ability to use smtplib.SMTP_SSL connection when sending email
|Reported by:||dje||Owned by:||nobody|
|Cc:||sorin, Simon Charette, senko||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||no|
There was a ticket opened three years ago to report this issue and it was brushed off with no investigation: https://code.djangoproject.com/ticket/9575. I've attached my patch which completely resolved the problem on my local machine. The problem seems to arise when using TLS, with username/password and port 465. I didn't have any servers with a port other than 465 to test with, but the previous bug report mentioned changing the port worked for them.
To reproduce the issue, I'd recommend using Gmail's servers (since they are free):
EMAIL_HOST_USER = 'user'
EMAIL_HOST_PASSWORD = 'pass'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
The servers I've tested it against are not just Gmail, so this is clearly not Google's issue. There may be an issue with the underlying Python SMTP library, but patching this in Django was the quickest way for me to get my project back up and running.
Change History (20)
comment:1 Changed 5 years ago by
|Component:||Uncategorized → Core (Mail)|
|Patch needs improvement:||set|
|Summary:||Using TLS and port 465 for SMTP email causing Django to hang sending. → Add ability to use smtplib.SMTP_SSL connection when sending email|
|Type:||Bug → New feature|
comment:5 Changed 5 years ago by
|Triage Stage:||Unreviewed → Accepted|