gpt4 book ai didi

node.js - 如何防止 SparkPost 更改电子邮件中的 url?

转载 作者:搜寻专家 更新时间:2023-10-31 23:00:25 24 4
gpt4 key购买 nike

我使用 SparkPost 从我的 node.js 应用程序发送电子邮件。

但是,所有链接都会转换为 url,例如:http://go.sparkpostmail1.com/f/a/EgvUoS2LdGPzMx-AURKwZA~~/AABUGAA~/RgRZK0BSP0EIAGukLuGW3OxXA3NwY1gEAAAAAFkGc2hhcmVkQgoAAVK7SFdpNVEbUhFuaWNvbGFzQGR1cmFuZC5jaAlRBAAAAABEUWh0dHBzOi8vZGlzaGx5Lm1lbnUvZC9XYXNoaW5ndG9uL1JlZ2VudF9UaGFpL0Jhc2lsX0phZS81NjBmMzk5MmQ0YWUxNTAzMDBmZWZmMGIiLEcCe30

我试过像这样禁用“click_tracking”(参见下面的代码示例),但它仍然无法正常工作。有没有人知道配置 SparkPost 以“按原样”发送电子邮件?

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

此特定示例包括选项键: https://github.com/SparkPost/node-sparkpost/blob/master/examples/transmissions/send_transmission_all_fields.js

关于node.js - 如何防止 SparkPost 更改电子邮件中的 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37492626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com