solving problem with chat emails

parent 83edc34f
......@@ -42,10 +42,10 @@ module.exports = {
return ([Promise.resolve(msg), StuSup.find({id_stu: params.id_stu}).populate('supervisor')]);
})
.spread((msg, stusups) => {
var emails = "";
var emails = [];
for (var i=0; i<stusups.length; i++) {
if (stusups[i].supervisor.id !== params.id_sup)
emails = emails + " " + stusups[i].supervisor.email;
emails.append(stusups[i].supervisor.email);
}
// Email body
......@@ -68,10 +68,12 @@ module.exports = {
locale: msg.supervisor.lang || 'es-es'
});
sails.log.debug("Sending chat notification on student " + msg.student.id + " to " + emails.join());
// Send Emails
mailService.mailer()
.send({
to: emails,
to: emails.join(),
text: message,
subject: subject
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment