refs #6067 fix(Mailer): await send email #1917

Merged
alexm merged 1 commits from 6067-mailer-await-email-send into master 2024-01-08 14:04:01 +00:00
1 changed files with 12 additions and 10 deletions

View File

@ -257,18 +257,20 @@ module.exports = function(Self) {
class Mailer { class Mailer {
async send(verifyOptions, cb) { async send(verifyOptions, cb) {
const url = new URL(verifyOptions.verifyHref); try {
if (process.env.NODE_ENV) url.port = ''; const url = new URL(verifyOptions.verifyHref);
if (process.env.NODE_ENV) url.port = '';
const params = { const email = new Email('email-verify', {
url: url.href, url: url.href,
recipient: verifyOptions.to recipient: verifyOptions.to
}; });
await email.send();
const email = new Email('email-verify', params); cb(null, verifyOptions.to);
email.send(); } catch (err) {
cb(err);
cb(null, verifyOptions.to); }
} }
} }