def customer_registered()

in application.py [0:0]


def customer_registered():
    """Send an e-mail using SES"""

    response = None
    if request.json is None:
        # Expect application/json request
        response = Response("", status=415)
    else:
        request_content = json.loads(request.data)
        message = dict()
        try:
            # If the message has an SNS envelope, extract the inner message
            if request_content["TopicArn"] and request_content["Message"]:
                message = json.loads(request_content["Message"])
            else:
                message = request_content

            # Connect to SES and send an e-mail
            ses = boto3.client("ses", application.config["AWS_REGION"])
            ses.send_email(
                Destination={
                    "ToAddresses": [
                        message["email"],
                    ],
                },
                Message={
                    "Body": {
                        "Text": {
                            "Charset": CHARSET,
                            "Data": BODY % (message["name"]),
                        },
                    },
                    "Subject": {
                        "Charset": CHARSET,
                        "Data": SUBJECT,
                    },
                },
                Source=application.config["SOURCE_EMAIL_ADDRESS"],
            )
            response = Response("", status=200)
        except Exception as ex:
            logging.exception("Error processing message: %s" % request.json)
            response = Response(ex.message, status=500)

    return response