【问题标题】:How do I reference and create dynamic emails with Sendgrid?如何使用 Sendgrid 引用和创建动态电子邮件?
【发布时间】:2019-01-04 06:29:06
【问题描述】:

我对这里的文档一无所知。

我正在尝试创建一个基本的 hello world 电子邮件模板,并带有一些简单的电子邮件替换 - 但我无法确定语法。

The documentation here 建议使用-igetreplaced- 语法,并给出以下示例:

<html>
  <head></head>
  <body>
    <p>Hello -name-,<br>
       Thank you for your interest in our products. I have set up an appointment to call you at -time- EST to discuss your needs in more detail. If you would like to reschedule this call, please visit the following link: `<a href="http://example.com/reschedule?id=-customerID-">reschedule</a>`

                Regards,

                -salesContact-
                -contactPhoneNumber-<br>
    </p>
  </body>
</html>

随附的 SMTP API JSON 标头可能如下所示:

{
  "to": [
    "example@example.com",
    "example@example.com"
  ],
  "sub": {
    "-name-": [
      "John",
      "Jane"
    ],
    "-customerID-": [
      "1234",
      "5678"
    ],
    "-salesContact-": [
      "Jared",
      "Ben"
    ],
    "-contactPhoneNumber-": [
      "555.555.5555",
      "777.777.7777"
    ],
    "-time-": [
      "3:00pm",
      "5:15pm"
    ]
  }
}

我尝试将这些粘贴到模板代码编辑器中,但它不起作用。

有人可以指出正确的文档以使语法正确吗?

【问题讨论】:

    标签: sendgrid


    【解决方案1】:

    语法是Handlebars

    像这样使用它:

    Hello {{name}} 
    

    有数据:

    {
        "name": "Bob"
    }
    

    【讨论】:

    • SendGrid 中的 SMTPAPI、mail.send personalizations 和基于 Handlebars 的动态代码编辑器都是不同的工具,都有自己的词汇表。
    猜你喜欢
    • 1970-01-01
    • 2016-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多