Skip to content

Node.js based forum software built for the modern web

closes #945

Baris Soner Usakli01cb67d1f3bd
diff --git a/src/emailer.js b/src/emailer.js
index 18c48256cc..aa9c24e350 100644
--- a/src/emailer.js
+++ b/src/emailer.js
@@ -32,18 +32,23 @@ Emailer.send = function(template, uid, params) {
}
}, function(err, results) {
User.getUserField(uid, 'email', function(err, email) {
- if (!err) {
- Plugins.fireHook('action:email.send', {
- to: email,
- from: Meta.config['email:from'] || '[email protected]',
- subject: params.subject,
- html: results.html,
- plaintext: results.plaintext,
-
- template: template,
- uid: uid
- });
+ if(err) {
+ return winston.error(err.message);
}
+
+ if(!email) {
+ return winston.warn('uid : ' + uid + ' has no email, not sending.');
+ }
+
+ Plugins.fireHook('action:email.send', {
+ to: email,
+ from: Meta.config['email:from'] || '[email protected]',
+ subject: params.subject,
+ html: results.html,
+ plaintext: results.plaintext,
+ template: template,
+ uid: uid
+ });
});
});
};