ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Use Jinja in Python file, for sending emails


I’ve created a function in which i’ve a list with some data,
i want to use that list data in frappe.sendmail function as a message,
i am not exactly sure that how to use list in message function, i’ve putted some html syntax in as a message i:e table,
i’ve tried to use jinja under message, but its not working,
can anybody please guide me how to do that?

Jinja in Email Template (with HTML)

use frappe.render_template(template, context) in your message


Thanks, let me try.


In template i can give path to html file which have jinja tags, but what is context?


Thanks @rmehta



I can only imagine all the storm of requests rmehta is obliged to ignore?

Instead for pointers and ideas best search the forum or code -

frappe@ubuntu:~/frappe-bench$ find . -name '*.py' | xargs grep frappe.render_template

Be sure to report back what you find or learn please and thanks