I use SparkPost to send emails from my node.js app.
However, all links are converted to urls such as: http://go.sparkpostmail1.com/f/a/EgvUoS2LdGPzMx-AURKwZA~~/AABUGAA~/RgRZK0BSP0EIAGukLuGW3OxXA3NwY1gEAAAAAFkGc2hhcmVkQgoAAVK7SFdpNVEbUhFuaWNvbGFzQGR1cmFuZC5jaAlRBAAAAABEUWh0dHBzOi8vZGlzaGx5Lm1lbnUvZC9XYXNoaW5ndG9uL1JlZ2VudF9UaGFpL0Jhc2lsX0phZS81NjBmMzk5MmQ0YWUxNTAzMDBmZWZmMGIiLEcCe30
I've tried to disable the "click_tracking" like this (see code sample below), but it's still not working. does anyone have an idea to configure SparkPost to send the emails "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!');
}
});
open and click tracking isn't set when you instantiate the SparkPost
object, it's done in the transmissionBody
via the options
key like so:
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!');
}
});
Additionally you can see examples for transmissions using node-sparkpost here: https://github.com/SparkPost/node-sparkpost/tree/master/examples/transmissions
This particular examples includes the options key: https://github.com/SparkPost/node-sparkpost/blob/master/examples/transmissions/send_transmission_all_fields.js