This commit is contained in:
barisusakli
2014-11-03 15:31:41 -05:00
parent 7bfc36ff56
commit d492339841
4 changed files with 51 additions and 10 deletions

View File

@@ -36,21 +36,25 @@ Emailer.send = function(template, uid, params) {
next(undefined, translated);
});
}, function(err, translated) {
if(err) {
if (err) {
return winston.error(err.message);
} else if (!results.email) {
return winston.warn('uid : ' + uid + ' has no email, not sending.');
}
Plugins.fireHook('action:email.send', {
to: results.email,
from: meta.config['email:from'] || 'no-reply@localhost.lan',
subject: translated[2],
html: translated[0],
plaintext: translated[1],
template: template,
uid: uid
});
if (Plugins.hasListeners('action:email.send')) {
Plugins.fireHook('action:email.send', {
to: results.email,
from: meta.config['email:from'] || 'no-reply@localhost.lan',
subject: translated[2],
html: translated[0],
plaintext: translated[1],
template: template,
uid: uid
});
} else {
winston.warn('[emailer] No active email plugin found!');
}
});
});
};