Sending emails using the Jinja template
Odoo supports creating dynamic emails through Jinja templates. Jinja is a text-based templating engine used to generate dynamic HTML content. In this recipe, we will create a Jinja email template and then send emails with its help.
Getting ready
For this recipe, we will be using the my_library
module from the previous recipe, Managing activities on documents. We will add the Jinja template to send an email to the borrower to tell them the book is overdue.
How to do it...
Follow these steps to send a reminder email to the borrower:
- Create a new file called
my_library/data/mail_template.xml
and add the email template:<?xml version="1.0" encoding="utf-8"?> <odoo noupdate="1"> Â Â Â Â <record id="book_return_reminder" model="mail.template"> Â Â Â Â Â Â Â Â <field name="name">Book Return Reminder<...