1

I want to allow my end users to create email templates and in the template allow them to specify dynamic info like in mail chimp.

Example:

"Hello Mr.{{last_name}} I am calling regarding an issue."

Dave
  • 602
  • 5
  • 18
  • You can following this answer https://stackoverflow.com/a/2810245/6396981 and https://godjango.com/19-using-templates-for-sending-emails/ – binpy Jul 20 '17 at 00:20

1 Answers1

1

You can use Django's built in templating engine to allow your users to create custom email templates, this seems to be a very common approach.

https://docs.djangoproject.com/en/1.11/topics/email/#send-mail https://docs.djangoproject.com/en/1.11/ref/templates/api/#rendering-a-context

You may also want to consider using a less featureful templating engine with your users though because Django templates allow your users to put some really wacky logic or Python expressions in your templates, it may be too permissive for the average user. I enjoy using Mustache for logic-less templates, it may be a simpler syntax and solution for your users, there is a Mustache implementation in python at Pystache.

A. J. Parr
  • 7,731
  • 2
  • 31
  • 46
  • Thanks for the mustache templating idea that will definitely help isolate any troublesome logic. – Dave Jul 20 '17 at 02:32