From 414d733d767b90d20ae6d13dded7ebacafa46549 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 28 Jul 2021 11:40:53 -0400 Subject: [PATCH] fix: bug where confirmation email was sent to the old email address, not the new one --- src/emailer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/emailer.js b/src/emailer.js index 51f2143879..e854fd0b23 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -219,6 +219,12 @@ Emailer.send = async (template, uid, params) => { } let userData = await User.getUserFields(uid, ['email', 'username', 'email:confirmed']); + + // 'welcome' and 'verify-email' explicitly used passed-in email address + if (['welcome', 'verify-email'].includes(template)) { + userData.email = params.email; + } + ({ template, userData, params } = await Plugins.hooks.fire('filter:email.prepare', { template, uid, userData, params })); if (!userData || !userData.email) { if (process.env.NODE_ENV === 'development') {