简体   繁体   English

Sendgrid 动态模板中的条件逻辑

[英]Conditional logic in Sendgrid Dynamic templates

Can I configure the Sendgrid dynamic template one of these options based on user behavior?我可以根据用户行为配置其中一个选项的 Sendgrid 动态模板吗?

  • One or more URL's to click要点击的一个或多个 URL
  • Redirect to a form重定向到表单

Does SendGrid template support conditional logic or is there an alternative way to achieve this via dynamic templates? SendGrid 模板是否支持条件逻辑,或者是否有其他方法可以通过动态模板实现这一点? ( I am looking for an AMP alternative actually ) (我实际上正在寻找 AMP 替代品)

You can send different content to a user based on the dynamic template data using handlebars conditionals .您可以使用把手条件根据动态模板数据向用户发送不同的内容。 But that still appears as static content in the email.但这仍然在电子邮件中显示为静态内容。 For example:例如:

{{#if user.profile.male}}
   <p>Dear Sir</p>
{{else if user.profile.female}}
   <p>Dear Madame</p>
{{else}}
   <p>Dear Customer</p>
{{/if}}

If you want the contents of the email to change dynamically within the email like an AMP email, but without using AMP, then you can use CSS to make a dynamic reveal .如果您希望电子邮件的内容像 AMP 电子邮件一样在电子邮件中动态更改,但不使用 AMP,则可以使用 CSS 进行动态显示 This isn't part of SendGrid Dynamic Templates though, it is just built with the HTML and CSS that goes into the email (which you can build in SendGrid, it's just not specific to SendGrid).不过,这不是 SendGrid 动态模板的一部分,它只是使用进入电子邮件的 HTML 和 CSS 构建的(您可以在 SendGrid 中构建,它不是特定于 SendGrid)。 This CSS technique may not be supported in all email clients though, so be sure to build the email in such a way that it can work without this behaviour too.但是,并非所有电子邮件客户端都支持这种 CSS 技术,因此请确保以这样一种方式构建电子邮件,即它也可以在没有这种行为的情况下工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM