问题
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