0

我试图设置一个包含多个把手的 Sendgrid 动态模板,包括一个带有每个把手的迭代器 整个电子邮件模板 html 可以找到

测试数据如下所示:

{
   "total":"1000",
   "items":[
      {
         "text":"Ebook 1",
         "qty":"1",
         "price":"3"
      },
      {
         "text":"Ebook 2",
         "qty":"2",
         "price":"3"
      },
      {
         "text":"ebook 3",
         "qty":"4",
         "price":"3"
      }
   ],
   "name":"John Doe",
   "address01":"Stargate 292",
   "city":"NY",
   "state":"NY",
   "zip":"4567",
   "orderId":"456",
   "expiry":"Nov 9 2021",
   "customerRef":"123"
}

出于某种原因,我在保存时不断收到此错误:

您的模板已成功保存,但我们检测到您的车把代码存在需要注意的问题。

我找不到任何其他错误消息可以准确地告诉我此错误发生的原因位置。

我正在使用 {{#each}} 迭代,不是 100% 确定这是否正确设置

{{#each items}}    
<table>
  <tr>
    <td>{{this.text}}</td>
  </tr>
  <tr>
    <td>{{this.qty}}</td>
  </tr>
  <tr>
    <td>{{this.price}}</td>
  </tr>
</table>
{{/each}}

其他车把只是基本的,例如{{ name }}{{ city }}等。

有没有人有这种错误的经验并知道如何解决它?

4

1 回答 1

0

在这个错字中发现了错误:

{{ customerRef} })

不得不将其更改为

{{ customerRef }}

课:

  1. 使用车把时要注意花括号
  2. Sendgrid 错误处理有望在未来更加详细!
于 2021-10-11T08:13:06.373 回答