fix: email testing and settings change from ACP

- changing email SMTP settings wouldn't apply the first time
- "Send Test Email" now will report emailer errors in most cases
This commit is contained in:
Peter Jaszkowiak
2020-12-05 14:25:14 -07:00
committed by Julian Lam
parent 713f029dc8
commit 2be396ff6e
16 changed files with 114 additions and 85 deletions

View File

@@ -181,8 +181,8 @@ async function pushToUids(uids, notification) {
}
body = posts.relativeToAbsolute(body, posts.urlRegex);
body = posts.relativeToAbsolute(body, posts.imgRegex);
await async.eachLimit(uids, 3, function (uid, next) {
emailer.send('notification', uid, {
await async.eachLimit(uids, 3, async (uid) => {
await emailer.send('notification', uid, {
path: notification.path,
notification_url: notification.path.startsWith('http') ? notification.path : nconf.get('url') + notification.path,
subject: utils.stripHTMLTags(notification.subject || '[[notifications:new_notification]]'),
@@ -190,7 +190,7 @@ async function pushToUids(uids, notification) {
body: body,
notification: notification,
showUnsubscribe: true,
}, next);
}).catch(err => winston.error('[emailer.send] ' + err.stack));
});
}