Implementing the notification service

Now that we have everything set up, and the files that we are going to use as a template to send emails to the customers of the online (video) game store are in place in the python-blueprints S3 bucket, it is time to start implementing the notification service.

Let's go ahead and create a file called app.py in the notifier directory, and to start with, let's add some imports:

import smtplibfrom http import HTTPStatusfrom smtplib import SMTPAuthenticationError, SMTPRecipientsRefusedfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartimport boto3from botocore.exceptions import ClientErrorfrom flask import Flaskfrom flask import request, Responsefrom jinja2 import Template

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.