Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#2897 closed enhancement (fixed)

[patch] Support TLS for django mail

Reported by: bjorn@… Owned by: Adrian Holovaty
Component: Core (Mail) Version:
Severity: normal Keywords:
Cc: jesse.lovelace@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (3)

django-mail-tls-patch.txt (1.8 KB ) - added by bjorn@… 17 years ago.
Patch to enable TLS support for django.core.mail.send*mail
django-mail-tls-patch.2.txt (2.3 KB ) - added by bjorn@… 17 years ago.
New version w/ default config variable global_settings
django-mail-tls-patch.3.txt (3.2 KB ) - added by mail@… 17 years ago.
modified and updated patch against rev 4815, works here with a hosted Google account

Download all attachments as: .zip

Change History (12)

by bjorn@…, 17 years ago

Attachment: django-mail-tls-patch.txt added

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

by bjorn@…, 17 years ago

Attachment: django-mail-tls-patch.2.txt added

New version w/ default config variable global_settings

comment:1 by Ramiro Morales, 17 years ago

Summary: Support TLS for django mail[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 :)

comment:2 by Adrian Holovaty, 17 years ago

Resolution: wontfix
Status: newclosed

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.

comment:3 by James Wheare <django@…>, 17 years ago

Component: Core frameworkdjango.core.mail
Triage Stage: UnreviewedDesign 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.

comment:4 by boxed@…, 17 years ago

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.

comment:5 by James Wheare <django@…>, 17 years ago

Resolution: wontfix
Status: closedreopened

by mail@…, 17 years ago

Attachment: django-mail-tls-patch.3.txt added

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

comment:6 by anonymous, 17 years ago

Cc: jesse.lovelace@… added

comment:7 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: reopenedclosed

(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.

comment:8 by aronchi, 16 years ago

My settings: EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'test@…' 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 comment:9 by Karen Tracey, 16 years ago

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.

Note: See TracTickets for help on using tickets.
Back to Top