How to add add if condition in AWS SES html template?

若如初见. 提交于 2021-01-27 23:33:04

问题


Requirement is to send templated mail based on received bodydata from api. BodyData may not contain some tags. see below sample Template part.

<p>{{sender}} has invited you to join team {{teamName}}</p>

so body data may not contain teamName. So I want to put if condition on {{teamName}} in template.

Please help me here to find solution


回答1:


For conditional logic in an SES template you can use if else statements like you would in code. For your example you would use something like

<p>{{sender}} has invited you to join team {{#if teamName}}{{teamName}}{{/if}}</p>

Taken from the following documentation

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-personalized-email-advanced.html



来源:https://stackoverflow.com/questions/54474310/how-to-add-add-if-condition-in-aws-ses-html-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!