📜  sendgrid nodejs 发送电子邮件模板 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:58.283000             🧑  作者: Mango

代码示例1
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: 'recipient@example.org',
  from: 'sender@example.org',
  templateId: 'd-f43daeeaef504760851f727007e0b5d0',
  dynamic_template_data: {
    subject: 'Testing Templates',
    name: 'Some One',
    city: 'Denver',
  },
};
sgMail.send(msg);