Django

Code

Ticket #2897 (closed: fixed)

Opened 2 years ago

Last modified 3 months ago

[patch] Support TLS for django mail

Reported by: bjorn@exoweb.net Assigned to: adrian
Milestone: Component: django.core.mail
Version: Keywords:
Cc: jesse.lovelace@gmail.com Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

This patch enables a new settings variable EMAIL_TLS, which if present and evaluates to non-zero, will make Django send emails using TLS (SSL). I don't have a local SMTP server set up on my laptop, so with this I can do development on the laptop and send emails via our office SMTP server which (sanely so) requires an encrypted connection.

Attachments

django-mail-tls-patch.txt (1.8 kB) - added by bjorn@exoweb.net on 10/11/06 02:52:23.
Patch to enable TLS support for django.core.mail.send*mail
django-mail-tls-patch.2.txt (2.3 kB) - added by bjorn@exoweb.net on 10/11/06 02:57:00.
New version w/ default config variable global_settings
django-mail-tls-patch.3.txt (3.2 kB) - added by mail@ping13.net on 03/25/07 14:28:36.
modified and updated patch against rev 4815, works here with a hosted Google account

Change History

10/11/06 02:52:23 changed by bjorn@exoweb.net

  • attachment django-mail-tls-patch.txt added.

Patch to enable TLS support for django.core.mail.send*mail

10/11/06 02:57:00 changed by bjorn@exoweb.net

  • attachment django-mail-tls-patch.2.txt added.

New version w/ default config variable global_settings

10/11/06 06:35:21 changed by ramiro

  • summary changed from Support TLS for django mail to [patch] Support TLS for django mail.

Adding the [patch] prefix to the Summary (and at the same time testing if the whitelisting of IP adddresses in Akismet works :)

10/24/06 15:42:09 changed by adrian

  • status changed from new to closed.
  • resolution set to wontfix.

This is outside the scope of Django's (very simple) mail-sending framework. The mail-sending framework intentionally does not do many things; for more intensive applications, you can just use Python's smtplib.

01/23/07 13:45:28 changed by James Wheare <django@sparemint.com>

  • component changed from Core framework to django.core.mail.
  • stage changed from Unreviewed to Design decision needed.

This is a problem if your host requires all SMTP connections to be via SSL. Since Django itself relies on this (very-simple) framework to send out broken link and 500 emails, it would be nice if it were equipped to handle this particular setup rather than choke on an smtplib error that my own app can't easily work around.

02/24/07 10:30:12 changed by boxed@killingar.net

The patch in #3560 gives support for gmail specificially, the patch in this issue does not.

I am with James on this. Plus, for my own domain I am using googles hosted email service, so I have no longer any access to a non-encrypted SMTP server. Considering google is making this service free this will only be more common in the future I predict.

02/24/07 12:18:26 changed by James Wheare <django@sparemint.com>

  • status changed from closed to reopened.
  • resolution deleted.

03/25/07 14:28:36 changed by mail@ping13.net

  • attachment django-mail-tls-patch.3.txt added.

modified and updated patch against rev 4815, works here with a hosted Google account

04/11/07 10:40:08 changed by anonymous

  • cc set to jesse.lovelace@gmail.com.

05/03/07 08:35:02 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [5144]) Fixed #2897 -- Added support for TLS connections to email handling. This means servers like Google's SMTP server can now be used for admin emails.

(follow-up: ↓ 9 ) 09/03/08 01:57:44 changed by aronchi

My settings: EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'test@gmail.com' EMAIL_HOST_PASSWORD = 'test' EMAIL_PORT = 587 EMAIL_USE_TLS = True

my view:

email = EmailMessage?(subject, t.render(c), to = [settings.CONTACT_FORM_TO],from_email='pippo@pluto')

In my gmail I receive the emails from my google identity, not the from I set.

Is there any solution?

(in reply to: ↑ 8 ) 09/03/08 13:24:11 changed by kmtracey

Replying to aronchi: You'd be better off posting your question on django-users. Very few people are going to notice a question posted in a closed ticket. Personally I'd guess the Google SMTP server does not allow you to lie about the from field, but you're more likely to find someone who knows for sure on the mailing list than here.


Add/Change #2897 ([patch] Support TLS for django mail)




Change Properties
Action