如何在发送网格上添加发件人名称

发布于 2025-01-20 10:51:43 字数 499 浏览 0 评论 0原文

下面的代码是我的SendGrid助手功能 目前,这就是从infogmail.com所包含的发件人名称“信息”。 。我想添加一个自定义名称。我已经阅读了文档,但我还没有看到解决问题的解决方案。我看到的所有解决方案都是为Python

  const msg = {
    to: email,
    from: `${SENDER_EMAIL}`,
    fromname: FROM_NAME,
    subject: "Thanks for the Gift",
    html: `${html(name, SENDER_EMAIL, SENDER_NAME)}`,
  };

  sgMail
    .send(msg)
    .then(() => {
      console.log("Email sent");
    })
    .catch((error) => {
      console.error(error);
    });
};```

The code below is my sendgrid helper function
presently, this is what comes up as the sender name "info" which is conned from infogmail.com. . i would like to add a custom name. i have read the docs but i have not seen a solution to my problem. all the solutions i saw was for python

  const msg = {
    to: email,
    from: `${SENDER_EMAIL}`,
    fromname: FROM_NAME,
    subject: "Thanks for the Gift",
    html: `${html(name, SENDER_EMAIL, SENDER_NAME)}`,
  };

  sgMail
    .send(msg)
    .then(() => {
      console.log("Email sent");
    })
    .catch((error) => {
      console.error(error);
    });
};```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光下的泡沫是彩色的 2025-01-27 10:51:43

您可以这样:

sendgrid.send({
  to: '[email protected]',
  from: {
      email: '[email protected]',
      name: 'Sender Name'
  },
  subject: 'Hello World',
  text: 'My first email through SendGrid'
});

You can in this way:

sendgrid.send({
  to: '[email protected]',
  from: {
      email: '[email protected]',
      name: 'Sender Name'
  },
  subject: 'Hello World',
  text: 'My first email through SendGrid'
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文