Modified to change email to all admins at once

pull/7098/head
Luis Fernando do Nascimento 9 years ago
parent 42201cf2c6
commit 4952eb1ec8
  1. 24
      server/lib/accounts.js

@ -118,17 +118,21 @@ Accounts.onCreateUser(function(options, user = {}) {
if (!user.active) {
user.emails.some((email) => {
const destinations = [];
RocketChat.models.Roles.findUsersInRole('admin').forEach(function(adminUser) {
email = {
to: adminUser.emails[0].address,
from: RocketChat.settings.get('From_Email'),
subject: Accounts.emailTemplates.notifyAdmin.subject(),
html: Accounts.emailTemplates.notifyAdmin.html(user)
};
Meteor.defer(() => {
Email.send(email);
});
destinations.push(`${ adminUser.name }<${ adminUser.emails[0].address }>`);
});
email = {
to: destinations,
from: RocketChat.settings.get('From_Email'),
subject: Accounts.emailTemplates.notifyAdmin.subject(),
html: Accounts.emailTemplates.notifyAdmin.html(user)
};
Meteor.defer(() => {
Email.send(email);
});
});
}

Loading…
Cancel
Save