如何在AWS SES html模板中添加if if条件? [英] How to add add if condition in AWS SES html template?

查看:89
本文介绍了如何在AWS SES html模板中添加if if条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求是根据从api接收到的bodydata发送模板邮件.BodyData可能不包含某些标签.参见下面的样例模板部分.

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>

因此正文数据可能不包含teamName.因此,我想将if条件放在模板中的{{teamName}}上.

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

推荐答案

对于SES模板中的条件逻辑,您可以使用if语句,就像在代码中那样.在您的示例中,您将使用

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>

来自以下文档

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

这篇关于如何在AWS SES html模板中添加if if条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆