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

Use Jinja in Python file, for sending emails


#1

Hi,
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)
#2

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


#3

Thanks, let me try.


#4

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


#5

Thanks @rmehta


#6

#7

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