[FIX] Mailer breaking if user doesn't have an email address (#14614)

pull/14424/head^2
Marcos Spessatto Defendi 6 years ago committed by Diego Sampaio
parent 482ae2d644
commit 14faa0d00a
  1. 3
      app/mail-messages/server/functions/sendMail.js

@ -42,8 +42,8 @@ export const sendMail = function(from, subject, body, dryrun, query) {
});
});
}
return Meteor.users.find(userQuery).forEach(function(user) {
if (user && user.emails && Array.isArray(user.emails) && user.emails.length) {
const email = `${ user.name } <${ user.emails[0].address }>`;
const html = placeholders.replace(body, {
@ -61,5 +61,6 @@ export const sendMail = function(from, subject, body, dryrun, query) {
subject,
html,
});
}
});
};

Loading…
Cancel
Save