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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠