Ich habe Templates in Sparkpost Dashboard erstellt. Aber das Problem, dem ich gegenüberstehe, ist, dass ich "CC" oder "BCC" nicht senden kann, indem ich die API-Anrufe mache. Der Codeausschnitt unten hilft Ihnen zu verstehen, was ich versuche zu tun.Senden von "CC" und "BCC" in Substitutionsdaten beim Aufruf von Knoten sparkpost API
var SPARKPOST_KEY = "KEY"
var sparkpost = require('sparkpost');
var sparkclient = new sparkpost(SPARKPOST_KEY);
var req_opts = {
\t transmissionBody : {
\t \t content: {
\t \t \t template_id: 'order-confirmation',
\t \t \t from: '[email protected]',
\t \t subject: 'Order confirmation',
\t \t headers: {
\t \t \t "CC": "<[email protected]>"
\t \t }
\t \t },
\t \t substitution_data: {
\t \t \t "CC": "[email protected]",
\t \t \t "customer": "Aravind",
\t \t \t "order": 123532
\t \t },
\t \t recipients: [
\t \t {address: {email:'[email protected]'}},
\t \t {address: {email: '[email protected]'}}
\t ],
\t "return_path": "[email protected]",
\t }
};
sparkclient.transmissions.send(req_opts, function(err, res){
\t if(err){
\t \t console.log("ERROR");
\t \t console.log(err)
\t }else {
\t \t console.log(res.body);
\t \t console.log("Mail has been successfully sent");
\t }
});
Scheint nicht mit Vorlagen zu arbeiten. Es ist ein Fehler: '{ " Fehler ": [ { " Nachricht ":" Pflichtfeld fehlt ", " Beschreibung ":" Mindestens eines von 'Text' oder 'HTML' muss in 'Inhalt vorhanden sein '", " code ":" 1400 " } ] }' –
Ihre Vorlage muss einen 'text' oder' html' Teil in 'content' enthalten. – orval
Warum brauche ich, wenn es nicht nötig ist? –