Amazon web services 用于电子邮件模板中的循环

Amazon web services 用于电子邮件模板中的循环,amazon-web-services,amazon-ses,Amazon Web Services,Amazon Ses,我们可以为SES模板创建for循环吗 查看这里的代码(),我看到的唯一示例是键值对 语法与我在handlebar.js中使用的语法类似 大概是这样的: { "Template": { "TemplateName": "MyTemplate", "SubjectPart": "Greetings, {{name}}!", "HtmlPart": "<h1>Hello {{name}},</h1><p>Your favorite ani

我们可以为SES模板创建for循环吗

查看这里的代码(),我看到的唯一示例是键值对

语法与我在
handlebar.js
中使用的语法类似

大概是这样的:

{
  "Template": {
    "TemplateName": "MyTemplate",
    "SubjectPart": "Greetings, {{name}}!",
    "HtmlPart": "<h1>Hello {{name}},</h1><p>Your favorite animals are {{#each animals}}<h1>{{favoriteanimal}}</h1>{{/each}}.</p>",
  }
}
{
“模板”:{
“TemplateName”:“MyTemplate”,
“主题部分”:“问候,{{name}}!”,
“HtmlPart”:“你好{{name},你最喜欢的动物是{{{each animals}}{{{favorite animal}{{/each}”。

”, } }

模板数据示例:

{
  "meta":{
    "userId":"51806220607"
  },
  "contact":{
    "firstName":"Anaya",
    "lastName":"Iyengar",
    "city":"Bengaluru",
    "country":"India",
    "postalCode":"560052"
  },
  "subscription":[
    {
      "interest":"Sports"
    },
    {
      "interest":"Travel"
    },
    {
      "interest":"Cooking"
    }
  ]
}
模板示例:

{
  "Template": {
    "TemplateName": "Preferences",
    "SubjectPart": "Subscription Preferences for {{contact.firstName}} {{contact.lastName}}",
    "HtmlPart": "<h1>Your Preferences</h1>
                 <p>You have indicated that you are interested in receiving 
                   information about the following subjects:</p>
                 <ul>
                   {{#each subscription}}
                     <li>{{interest}}</li>
                   {{/each}}
                 </ul>
                 <p>You can change these settings at any time by visiting 
                    the <a href=https://www.example.com/prefererences/i.aspx?id={{meta.userId}}>
                    Preference Center</a>.</p>",
    "TextPart": "Your Preferences\n\nYou have indicated that you are interested in 
                 receiving information about the following subjects:\n
                 {{#each subscription}}
                   - {{interest}}\n
                 {{/each}}
                 \nYou can change these settings at any time by 
                 visiting the Preference Center at 
                 https://www.example.com/prefererences/i.aspx?id={{meta.userId}}"
  }
}
{
“模板”:{
“TemplateName”:“首选项”,
“SubjectPart:“{{contact.firstName}}{{contact.lastName}}的订阅首选项”,
“HtmlPart”:“您的首选项”
您已表示有兴趣接收
关于下列主题的信息:

    {{{#每个订阅}
  • {{利息}
  • {{/每个}}
您可以通过访问随时更改这些设置 .

“, “TextPart”:“您的首选项\n\n您已表示对 正在接收有关以下主题的信息:\n {{{#每个订阅} -{{interest}}\n {{/每个}} \您可以随时通过以下方式更改这些设置: 访问位于 https://www.example.com/prefererences/i.aspx?id={{meta.userId}” } }
更多信息可在此处找到: