To send an email, we first need to generate its content. In this recipe, we'll see how to generate a proper template, in both text-only style and HTML.
Working with email templates
Getting ready
We should start by installing the mistune module, which will compile Markdown documents into HTML. We will also use the jinja2 module to combine HTML with our text:
$ echo "mistune==0.8.3" >> requirements.txt
$ echo "jinja2==2.20" >> requirements.txt
$ pip install -r requirements.txt
In the GitHub repo, there are a couple of templates we will use—email_template.md in https://github.com/PacktPublishing/Python-Automation-Cookbook/blob/master/Chapter08/email_template.md and a template for styling...