Adding Template Data when sending Custom Verification Emails

0

Hi,

So when sending an email, I want to be able to provide data so that the template body (template content) containing the html code can utilize the curly brackets {{}} so that it gets replaced with the provided data.

I know this can easily be done when sending a templated email by providing TemplateData when using the API call, but I want to do the same when sending a custom verification email when using the API call: SendCustomVerificationEmail.

Does anyone know if this can be done at all? Or are you completely restricted with a pre-defined template when using Email Verification Templates?

asked 2 years ago509 views
1 Answer
1
Accepted Answer

You could add your template before sending the email using the API call CreateCustomVerificationEmailTemplate (https://docs.aws.amazon.com/ses/latest/APIReference/API_CreateCustomVerificationEmailTemplate.html), then refer to that template when calling SendCustomVerificationEmail.

If you are not using the template again, you can delete it after sending the email using DeleteCustomVerificationEmailTemplate, but make sure the email has been sent and is not being sent asynchronously else you might delete the template before its being used!

answered 2 years ago
  • Ahh perfect! Yeah I didn't think of that. That'll work, I'll just make sure to wait for the callbacks. Cheers.

  • @Rollerblade7 Does this mean one has to interpolate TemplateData programatically before creating the Template and then send it calling SendCustomVerificationEmail ?

  • Yes. So when updating the Custom Verification Email Template, it takes the 'TemplateContent' as an entire string, so I just make sure to format the string in code with the data I want in it before I make the request to update the email template. Then when it finishes updating, I then immediately send the verification email using that updated template. To format the TemplateContent string, I make sure to include the {0} symbols within the html string. You essentially have to implement the TemplateData behaviour yourself for custom verification email templates.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions