如何防止 SparkPost 更改电子邮件中的 url?
How to prevent SparkPost from changing urls in emails?
我使用 SparkPost 从我的 node.js 应用程序发送电子邮件。
我试过像这样禁用 "click_tracking"(请参阅下面的代码示例),但它仍然无法正常工作。有谁知道配置 SparkPost 发送电子邮件 "as is"?
var sparky = new SparkPost(process.env.SPARKPOST_API_KEY, {"open_tracking": false, "click_tracking": false});
sparky.transmissions.send({transmissionBody: transmissionBody}, function (err, res) {
if (err) {
console.log('Whoops! Something went wrong in sendEmail');
console.log(err);
} else {
console.log('sendEmail sent!');
}
});
在实例化 SparkPost
对象时未设置打开和点击跟踪,它是通过 options
键在 transmissionBody
中完成的,如下所示:
var SparkPost = require('sparkpost');
var sp = new SparkPost('<YOUR API KEY>');
sp.transmissions.send({
transmissionBody: {
options: {
open_tracking: false,
click_tracking: false
},
content: {
from: 'testing@sparkpostbox.com',
subject: 'Hello, World!',
html:'<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>'
},
recipients: [
{address: '<YOUR EMAIL ADDRESS>'}
]
}
}, function(err, res) {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
} else {
console.log('Woohoo! You just sent your first mailing!');
}
});
此外,您还可以在此处查看使用 node-sparkpost 进行传输的示例:
https://github.com/SparkPost/node-sparkpost/tree/master/examples/transmissions
我使用 SparkPost 从我的 node.js 应用程序发送电子邮件。
我试过像这样禁用 "click_tracking"(请参阅下面的代码示例),但它仍然无法正常工作。有谁知道配置 SparkPost 发送电子邮件 "as is"?
var sparky = new SparkPost(process.env.SPARKPOST_API_KEY, {"open_tracking": false, "click_tracking": false});
sparky.transmissions.send({transmissionBody: transmissionBody}, function (err, res) {
if (err) {
console.log('Whoops! Something went wrong in sendEmail');
console.log(err);
} else {
console.log('sendEmail sent!');
}
});
在实例化 SparkPost
对象时未设置打开和点击跟踪,它是通过 options
键在 transmissionBody
中完成的,如下所示:
var SparkPost = require('sparkpost');
var sp = new SparkPost('<YOUR API KEY>');
sp.transmissions.send({
transmissionBody: {
options: {
open_tracking: false,
click_tracking: false
},
content: {
from: 'testing@sparkpostbox.com',
subject: 'Hello, World!',
html:'<html><body><p>Testing SparkPost - the world\'s most awesomest email service!</p></body></html>'
},
recipients: [
{address: '<YOUR EMAIL ADDRESS>'}
]
}
}, function(err, res) {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
} else {
console.log('Woohoo! You just sent your first mailing!');
}
});
此外,您还可以在此处查看使用 node-sparkpost 进行传输的示例: https://github.com/SparkPost/node-sparkpost/tree/master/examples/transmissions