Search code examples
amazon-web-servicesamazon-ses

Is it possible to send templated emails via SES whilst in sandbox mode/


I am attempting to test the sending of a templated email via AWS SES via a python lambda function.

The process runs without any error and in the Cloudwatch log I do get a message stating that the email has been sent, however the email is not actually received (both the sending and receiving email addresses are verified).

If the same process is run without the template then the email is received.

Below is the code

`   template_data = {}
    template_data['toBeReplaced'] = body

    # print(json.dumps(template_data))
    strTemplateData = json.dumps(template_data)
    print(strTemplateData)

    response = client.send_templated_email(
      Source=SENDER,
      Destination={
        'ToAddresses': emailAdds,
        'CcAddresses': ['XXXXXXXXXX.co.uk']
      },
      ReturnPath='xxxxxxxxxxxxxx.xo.uk',
      Template='emailTemplate3',
      TemplateData=strTemplateData     
    )`

Solution

  • Have you checked the Rendering Failure CloudWatch metric ? If there is something is wrong with template (or the values you passed) , you still get 200OK and a Message ID but the email is actually rejected and can be shown in the Rendering Failure CloudWatch metric.

    You can enable Configuration sets and enable SNS notification for rendering failure, you'll get an exact description on what went wrong in the template.