Skip to content

Node.js based forum software built for the modern web

fix: bug where confirmation email was sent to the old email address, not the new one

Julian Lam414d733d767b
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') {