#17193: Send templated email.
-----------------------------+-------------------------------------------
Reporter: tomchristie | Owner: julianapplebaum
Type: New feature | Status: assigned
Component: Core (Mail) | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------------
Comment (by tevans.uk@…):
I have a few doubts about how this has been designed. With both html and
plain 'templates' actually just being blocks of a single template, it is
not possible to use template inheritance to design consistent emails,
which is a common use of the template system. Without this, styles would
need to be replicated across multiple templates.
In our send_mail wrapper at $JOB, we allow the user to pass in the stub
name of a template. The utility then attempts to render the templates
stub+'.html' and stub+'.txt', and uses the results of these to determine
whether we send a text/plain, text/html or multipart/alternative.
Instead of extracting the subject from a template, we allow it to be
passed in directly. We also add a language argument, which is used to
activate the appropriate translation prior to rendering the emails, or
coercing the subject to unicode. This allows us to send fully translated
emails appropriate for the user receiving the email - which may not be the
same as the language currently activated, if there is any, or the language
that has been activated for the current view.
Cheers
Tom (one of these days I'll remember my trac login)
--
Ticket URL: <https://code.djangoproject.com/ticket/17193#comment:10>
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.