电子邮件模板不适用于嵌套的输入对象(handlebar3-mailgun)

问题描述 投票:0回答:1

对我来说,模板似乎不适用于嵌套输入对象。考虑到模板,我的意思是:

这很好用

<p ">Your Cat Thanks You  {{name}}</p>

带有变量:

{name:'joe'}

这不起作用:

<p ">Your Cat Thanks You  {{personalInfo.firstName}} {{personalInfo.lastName}}</p>

带有变量:

{personalInfo:{firstName:'John',lastName:'Doe'}}

我正在将nodjs与mailg-js libary一起使用,这些选项似乎还不错:

const mailData= {from: "some shop <[email protected]>",
      to: "[email protected]",
      subject: "example",
      template: exampleTemplateName,
      ["h:X-Mailgun-Variables"]: JSON.stringify(exampleJson)}


mailgun({
  apiKey: api_key,
  domain: DOMAIN,
  host: "api.eu.mailgun.net"
}).messages().send(mailData)
javascript node.js email handlebars.js mailgun
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.