Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.send_email = function(host, email_data, callback){
this.log('Trying to send to ' + email_data.to + ' at ' + host);
if(!this.em) this.em = new mailer.EmailMessage(email_data);
else { // nasty fix to prevent nodemailer from duplicating from/to addresses
this.em.fromAddress = [];
this.em.toAddress = [];
}
this.em.SERVER = { host: host }
this.em.send(function(error, success){
if(error) self.log("!! " + error);
if(success) self.log(' -- Message sent!');
return callback(success);
});
};
function dispatchMail(message, server, callback) {
var _message = {
to: message.to,
sender: message.from,
subject: message.subject,
server: server,
debug: message.debug
};
if(message.html)_message.html = message.html;
pool.send(new EmailMessage(merge(message, _message)), callback);
}