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?

1回答
1
承認された回答

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!

回答済み 2年前
  • 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.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ