Error thrown while sending mail through socket
-
Tried to send a simple form data from a client page to the sever, received data all fine through a custom plugin socket but while sending an email inside same socket connection gives following error:
error: Cannot read property 'language' of undefined TypeError: Cannot read property 'language' of undefined at async.map.Plugins.fireHook.to (/root/nodebb/src/emailer.js:35:46) at /root/nodebb/node_modules/async/lib/async.js:249:17 at /root/nodebb/node_modules/async/lib/async.js:125:13 at Array.forEach (native) at _each (/root/nodebb/node_modules/async/lib/async.js:46:24) at async.each (/root/nodebb/node_modules/async/lib/async.js:124:9) at _asyncMap (/root/nodebb/node_modules/async/lib/async.js:248:13) at Object.map (/root/nodebb/node_modules/async/lib/async.js:219:23) at /root/nodebb/src/emailer.js:34:9 at /root/nodebb/node_modules/async/lib/async.js:592:17
It seems inside these lines
}, function(err, results) { async.map([results.html, results.plaintext, params.subject], function(raw, next) { translator.translate(raw, results.settings.language || meta.config.defaultLang || 'en_GB', function(translated) { next(undefined, translated); }); }, function(err, translated) {
'results' is not defined
for testing tried removing 'results.settings.language'
then get
warn: uid : 9 has no email, not sending.
which I think is again due to 'results.email' being not defined.
-
@vatsal said:
Tried to send a simple form data from a client page to the sever, received data all fine through a custom plugin socket but while sending an email inside same socket connection gives following error:
error: Cannot read property 'language' of undefined TypeError: Cannot read property 'language' of undefined at async.map.Plugins.fireHook.to (/root/nodebb/src/emailer.js:35:46) at /root/nodebb/node_modules/async/lib/async.js:249:17 at /root/nodebb/node_modules/async/lib/async.js:125:13 at Array.forEach (native) at _each (/root/nodebb/node_modules/async/lib/async.js:46:24) at async.each (/root/nodebb/node_modules/async/lib/async.js:124:9) at _asyncMap (/root/nodebb/node_modules/async/lib/async.js:248:13) at Object.map (/root/nodebb/node_modules/async/lib/async.js:219:23) at /root/nodebb/src/emailer.js:34:9 at /root/nodebb/node_modules/async/lib/async.js:592:17
It seems inside these lines
}, function(err, results) { async.map([results.html, results.plaintext, params.subject], function(raw, next) { translator.translate(raw, results.settings.language || meta.config.defaultLang || 'en_GB', function(translated) { next(undefined, translated); }); }, function(err, translated) {
'results' is not defined
for testing tried removing 'results.settings.language'
then get
warn: uid : 9 has no email, not sending.
which I think is again due to 'results.email' being not defined.