DEV Community

Cover image for Send an HTML Email Template with Python and Jinja2

Send an HTML Email Template with Python and Jinja2

Carola Corvalán on July 13, 2019

This is my first post in dev.to. As a beginner developer and as a practice exercise, I have learned how to send an HTML Email template using Pytho...
Collapse
 
keshavadk profile image
keshavadk

Hi. Can i know what env = Environment(
loader=FileSystemLoader('%s/templates/' % os.path.dirname(file))) means in this script

whether we should change the path if we are using Ubuntu?

Thank you.

Collapse
 
jschilen profile image
jschilen
Collapse
 
jyunyan profile image
jyun-yan

Hi
i am new to python ,may i know what is "event, context" what should i put in ?

def send_movie_list(event, context):
json_data = get_data()
template = env.get_template('child.html')
output = template.render(data=jsonData[0])
send_mail(output)

return "Mail sent successfully."

Collapse
 
david9100 profile image
david9100

Great article - worked like a charm!

Collapse
 
tymg profile image
Matt Green

This was super helpful! Helped me start up my own email project!