const nodemailer = require('nodemailer');
var sparkPostTransport = require('nodemailer-sparkpost-transport');
const transporter = nodemailer.createTransport(sparkPostTransport({
'sparkPostApiKey': 'cfc389be072f1d7b6117fd7c9a2ccc3c........',
'options': {
'open_tracking': true,
'click_tracking': true,
'transactional': true
},
'campaign_id': 'viralchain.net'
}));
let _config = {
from: config.mail.active.send,
to: data.mail,
subject: config.mail.active.sub,
text: config.mail.active.text, // plain text body
html: htmlTemplateEmail // html body
}
transporter.sendMail(_config, function (err, info) {
if (err) {
console.log('Error: ' + err);
cb(err, null);
} else {
console.log('Success: ' + info);
cb(null, info);
}
});
config like :
{ from: 'Viralchain.net',
to: 'hoanghiep1x0@gmail.com',
subject: 'Viralchain Send Mail active',
text: 'active acount from link ',
html: 'html template' }
config like :
error Error: SparkPostError: Bad Request
errors: [ { message: 'Invalid domain', description: 'No sending domain specified', code: '7001' } ], statusCode: 400 }
sorry i updated the key permissions so i got an error