【问题标题】:nodejs + Sendgrid Template using sendgrid/mail failure ('to' value is empty, blocked message)nodejs + Sendgrid 模板使用 sendgrid/mail 失败('to' 值为空,被阻止的消息)
【发布时间】:2020-06-30 18:55:46
【问题描述】:

我正在使用 Sendgrid 节点模块 @sendgrid/mail 并作为测试我按照以下代码对收件人电子邮件地址进行硬编码的一种方式。当我使用模板(预置在 Sendgrid 中)时,我在 Sendgrid 中看到电子邮件收件人字段为 null 并且错误“被阻止”(顺便说一句,禁止列表中没有任何内容)。发送没有 DynamicTemplateData 部分的电子邮件工作正常

 const msg = {
      to: 'xxx@xxxxx.com',
      from: 'yyy@yyy.com',
      subject: 'Blah',
      text: 'Blah....,
      html: '<p>Blah....</p>',
      templateId: 'd-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      dynamicTemplateData: {
        subject: subject,
        link: resetLink
      },
    };

    (async () => {
      try {
        await sgMail.send(msg);
      } catch (error) {
        console.error(error);
      }
    })();

【问题讨论】:

    标签: node.js sendgrid


    【解决方案1】:

    这可能是因为您使用的 templateId 处于非活动状态。在 Sendgrid 控制台中将其设置为活动并重试。

    SendGrid 在阻塞“to”行的同时发送 202 条响应——遇到了同样的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多