【问题标题】:Why is this a tag not working inside the html tag inside sendgrid?为什么这个标签在 sendgrid 内的 html 标签内不起作用?
【发布时间】:2020-10-13 07:52:13
【问题描述】:

我正在尝试通过 SendGrid 发送邮件,我之前从未使用过邮件服务。这是第一次使用。

在您的应用内

const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(
  "*******************" // API KEY
);

const msg = {
  to: "sp@gmail.com",
  from: "berryy@gmail.com",
  subject: "Sending with sendgrid from testing site",
  text: "weofaowefnaowefinawefo",
  html: `<a> https//www.google.com </a>`,
};

try {
  sgMail.send(msg);
} catch {
  console.log('err sending mail')
}

如您所见,我正在发送一个带有标签的链接,该链接指向谷歌。 因此,由于我在 HTML 标记内编写。它应该发送一个 link 对,但他们正在向我发送一个 string。 SendGrid 不支持链接吗?

【问题讨论】:

  • 不要在网上发布你的api密钥,你应该尽快重置它
  • 当您说“字符串”时,您的意思是电子邮件显示 https//www.google.com 作为字符串还是显示 &lt;a&gt; https//www.google.com &lt;/a&gt;,完成有标签吗?
  • @Reyno 谢谢我犯了一个初学者的错误,我实际上将 api 缩短了 30 个字,所以它不应该工作。答案很简单。我想我是因为长时间工作而头脑发热

标签: javascript reactjs sendgrid


【解决方案1】:

你没有提供参考。

<a href="https://www.google.com" > https://www.google.com </a>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-11
    • 2018-05-05
    • 1970-01-01
    • 1970-01-01
    • 2021-09-29
    • 1970-01-01
    相关资源
    最近更新 更多