我如何使用node和sendgrid发送电子邮件,包括链接?

时间:2020-03-11 16:03:15

标签: node.js sendgrid

我当前正在尝试在节点应用程序中使用sendgrid发送电子邮件,其中包括用于电子邮件确认的链接。我完全不确定如何实现这一目标,文档也无济于事。如果有人知道该怎么做,请提出建议。 当前代码:

const msg = {
      to: userObj.username,
      from: "email",
      subject: "dashboard account",
      text: `Hello, you have successfully created an account for the Dashboard`,
      html: "<a href='localhost:1337/'>Confirm Email<a/>"
    };
sgMail.send(msg).catch(err => console.log(err));

电子邮件已正确发送,但仅包含“确认电子邮件”字样,没有链接。

1 个答案:

答案 0 :(得分:0)

尝试这样:

html: `<a href='https://github.com/zishon89us/node-cheat/blob/master/send_emails/send_grid.js#L40'>This is Link<a/>`