通过SendGrid电子邮件API和Node.JS发送对象

时间:2019-04-04 14:15:14

标签: node.js npm sendgrid

是否有一种方法可以在调用的html部分中遍历一个对象?我有一些子对象,需要在电子邮件中显示它们的值。

const sgMail = require('@sendgrid/mail')
sgMail.setApiKey(process.env.SENDGRID_API_KEY)

const sendReviewsCount = (reviewsCount, email) => {

    const msg = {
        to: email,
        from: 'test@test.com',
        subject: `Reviews Total`,
        html: `${reviewsCount}`,
      };

    sgMail.send(msg);
}

module.exports = {
    sendReviewsCount
}

0 个答案:

没有答案