Email sendgrid电子邮件模板中的If语句
我正在为Sendgrid构建电子邮件模板。是否有方法在模板中插入if语句,检查是否存在来自服务器的变量,并显示或隐藏电子邮件中显示该变量的行?SendGrid使用手柄作为动态模板。要有条件地渲染某些内容,可以使用:Email sendgrid电子邮件模板中的If语句,email,html-email,Email,Html Email,我正在为Sendgrid构建电子邮件模板。是否有方法在模板中插入if语句,检查是否存在来自服务器的变量,并显示或隐藏电子邮件中显示该变量的行?SendGrid使用手柄作为动态模板。要有条件地渲染某些内容,可以使用: {{#if user.profile.male}} <p>Dear Sir</p> {{else if user.profile.female}} <p>Dear Madame</p> {{else}} <p>D
{{#if user.profile.male}}
<p>Dear Sir</p>
{{else if user.profile.female}}
<p>Dear Madame</p>
{{else}}
<p>Dear Customer</p>
{{/if}}
{{#if user.profile.male}
亲爱的先生
{{else if user.profile.female}
亲爱的夫人
{{else}
亲爱的客户:
{{/if}