Don't send emails if missing smtp host

This commit is contained in:
Julen Landa Alustiza 2017-03-28 12:25:27 +02:00
parent feafc46bb5
commit 5db786e2dd
4 changed files with 47 additions and 36 deletions

View file

@ -26,15 +26,17 @@ Meteor.startup(() => {
const text = texts.join('\n\n');
user.clearEmailBuffer();
try {
Email.send({
to: user.emails[0].address.toLowerCase(),
from: Accounts.emailTemplates.from,
subject: TAPi18n.__('act-activity-notify', {}, user.getLanguage()),
text,
});
} catch (e) {
return;
if (Settings.findOne().mailUrl()) {
try {
Email.send({
to: user.emails[0].address.toLowerCase(),
from: Accounts.emailTemplates.from,
subject: TAPi18n.__('act-activity-notify', {}, user.getLanguage()),
text,
});
} catch (e) {
return;
}
}
}, 30000);
});