#20817 closed New feature (fixed)
Add support for html email messages through django.core.mail.send_mail()
Reported by: | Justin Michalicek | Owned by: | nobody |
---|---|---|---|
Component: | Core (Mail) | Version: | dev |
Severity: | Normal | Keywords: | mail, send_mail |
Cc: | timograham@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
I have run into several instances where it makes sense to be able to send html email messages through django.core.mail.send_mail(). Allowing this would also be consistent with the mail_admins() and mail_managers() functions.
When adding this I did see that the comments for send_mail() say that the api is frozen. I had previously asked about this feature on the django-developers google group in this thread https://groups.google.com/forum/#!topic/django-developers/_mXKP9JZzK0 so I hope this is not a problem.
I have forked the repo and created a feature branch at https://github.com/jmichalicek/django/tree/add_send_mail_html_message which has the feature, updated documentation, and test cases.
Change History (5)
comment:1 by , 11 years ago
Cc: | added |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Triage Stage: | Accepted → Unreviewed |
---|
Thanks, I've updated the docs as noted in the comments.
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 11 years ago
For the sake of completeness -- yes, I've got the git blame attribution for the "frozen" comments, but I wasn't the original author. The original author of those comments was Malcolm d5d2072bbfc38015a93d6e13136c3f1dbf125d87. He made that change because the intention was to discourage people from using send_mail, and encourage the use of EmailMessage instead. The intention was that Django should only have the bare minimum tools for sending mail; if you wanted more, you should be using Python native features. We had a lot of feature requests on django-users/django-dev to add extra arguments to send_mail; the comment in the code was an attempt to stop those requests.
However, since that time, the world has changed a bit. We've introduced mail backends, which massively increased the scope of the mail APIs in Django. We fixed #10863, which added HTML mail functionality to some (but not all) of the internal mail sending tools. More generally, HTML mails have become a lot more common/acceptable.
Given that Russ seemed to accept the ticket in the mailing list and was the one who committed the original change which included the comment about the API being frozen, I assume this is fine.
I left minor doc comments on the PR.