2

我想用 node.js 应用程序编写 html 电子邮件。电子邮件发送成功。当我记录文本时,它会显示类似这样的内容

<html><body><h1>Hi John!</h1><p>Jack just shared graph with you</p><p><a href='https://some.url.here/blablabla'>View here</a></p></body></html>

当我用谷歌收件箱打开这封电子邮件时,它很好地显示了我的 html,但是标签没有 href 属性,所以我无法从电子邮件中转到给定的 url。我正在使用 sparkpost 发送电子邮件。

谁能告诉我为什么会这样?

4

1 回答 1

5

您可能想尝试为您的 href 使用双引号。我能够使用developers.sparkpost.com的代码示例让它工作

var key = '<YOUR API KEY>'
, SparkPost = require('sparkpost')
, sparky = new SparkPost(key);

sparky.transmissions.send({
  transmissionBody: {
    content: {
      from: 'testing@sparkpostbox.com',
      subject: 'Oh hey!',
      html:'<html><body><h1>Hi John!</h1><p>Jack just shared graph with you</p><p><a href="https://some.url.here/blablabla">View here</a></p></body></html>'
    },
    recipients: [
      {address: 'developers+stackoverflow@sparkpost.com'}
    ]
  }
}, function(err, res) {
  if (err) {
    console.log('Whoops! Something went wrong');
    console.log(err);
  } else {
    console.log('Woohoo! You just sent your first mailing!');
  }
});
于 2016-03-28T20:09:56.473 回答