DEV Community

Discussion on: Django transactional emails made easy

Collapse
 
vinaypai profile image
Vinay Pai

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.

Collapse
 
djangotricks profile image
Aidas Bendoraitis

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.

Thread Thread
 
vinaypai profile image
Vinay Pai

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.

Thread Thread
 
djangotricks profile image
Aidas Bendoraitis

OK. I see the point. Worth consideration :)