如何使用dynamicTemplateData在Node.js中使用sendgrid发送电子邮件?

时间:2020-09-01 11:58:09

标签: node.js sendgrid sendgrid-templates

这是我第一次使用sendgrid接收邮件。我从数据库传递的动态数据有问题。实际上,HTML内容通过对象传递并在邮件中按原样显示。有关更多详细信息,请检查下面的对象。

javapackage

代码

{
    to: "to Email"
    from: "from email",
    templateId: "Template ID",
    dynamicTemplateData: {
        subject: "Testing Templates",
        name: "Some One",
        city: "Denver",
        week: "August 24 2020",
        job0: {
            header: "Test",
            body: "<table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="
            snip ">We are looking for physically fit individuals to fill general labour requirements by partnering with a truck driver. Your help is needed to load/unload the truck at the various job sites. <b>Skills required: </b> - comfortable with physical exertion and lifting minimum of 50lbs - works well on a team but trusted to work independently - reliable, self-motivated and committed to high standards of quality - able to read and understand work instructions <b>Specific requirements: </b> - in good physical condition - must have own safety footwear - reliable transportation to ensure punctual and consistent attendance If you meet the qualifications listed above, submit your resume in MS Word format via the link below. <i>Previously employed with The Staffing Connection? Please contact our office to confirm your continued availability for these upcoming positions.</i></td> </tr> </tbody> </table>",
            cta: "Apply now",
            url: "My URL"
        },
    }
}

这是输出

enter image description here

请帮助我解决此问题。

0 个答案:

没有答案