re: Django transactional emails made easy VIEW POST


Interesting approach, but I don't see any big advantages of using blocks instead of full template files for templates. In one of my projects, for each email I am using two templates: one for the HTML version and one for the text version. All of those email templates are extending either HTML or text base template. So all of the emails are automatically branded the same: the same header and footer, the same styling, the same signature.

I would see the blocks approach useful only if they extend some common base and have a specific view which shows both versions, text and html, in a single page.


I personally prefer having it in one file, but that's just a personal preference. How do you deal with subject lines? In the past I've had to have a single line file for the subject, which I find pretty obnoxious.


As the subjects don't contain any template information, I am passing them to my email sending function as simple strings from the view or from the form.

IMHO subjects should be more than just simple strings. They're the first thing the user sees when they get the email and I want it to be as informative as possible.

For example if they have a single notification it might read "Aidas Bendoraitis commented on your post" if there are multiple comments it might read "3 people commented on your post" if there is more than one kind of notification it might read "You have 4 new messages".

You could of course generate those kind of strings in your view function, but I prefer to have it in the template rather than code.

OK. I see the point. Worth consideration :)

Code of Conduct Report abuse