Best practice for replacing the password_forgotten email (No hook/trigger available)?
Posted: Tue Aug 18, 2026 8:09 pm
Hello everyone,
I am working on unifying all of our store's emails into custom HTML Notification Modules. I successfully did this for Order Confirmations and Account Creations, but I have hit a roadblock trying to replace the native password_forgotten.php email.
In the core password_forgotten.php root file, the $reset_key is generated, saved to the database, and the plain-text email is sent via Notifications::mail() all in one hardcoded block.
Because there is no $hooks->call or native module trigger broadcasted for this specific email, my standard Notification Module cannot "hear" the event to take over.
I tried two approaches, but neither feels like the correct "Phoenix Way":
Page Override: I tried placing a modified copy of the controller in templates/override/includes/pages/password_forgotten.php. However, because it's a root file, doing this causes application_top.php to load twice, resulting in a fatal wall of "Constant already defined" errors.
injectAppTop Hook: I can successfully hijack the $_POST['action'] == 'process' submission using an injectAppTop hook, generate the reset key myself, send the HTML email, and redirect the user before the core file runs. This works, but duplicating the core logic in a hook feels heavy.
My Question:
What is the recommended, upgrade-safe method for intercepting or overriding the password_forgotten.php email block to send an HTML template via a notifications module, given that it lacks a native trigger?
Thank you in advance for the guidance!
I am working on unifying all of our store's emails into custom HTML Notification Modules. I successfully did this for Order Confirmations and Account Creations, but I have hit a roadblock trying to replace the native password_forgotten.php email.
In the core password_forgotten.php root file, the $reset_key is generated, saved to the database, and the plain-text email is sent via Notifications::mail() all in one hardcoded block.
Because there is no $hooks->call or native module trigger broadcasted for this specific email, my standard Notification Module cannot "hear" the event to take over.
I tried two approaches, but neither feels like the correct "Phoenix Way":
Page Override: I tried placing a modified copy of the controller in templates/override/includes/pages/password_forgotten.php. However, because it's a root file, doing this causes application_top.php to load twice, resulting in a fatal wall of "Constant already defined" errors.
injectAppTop Hook: I can successfully hijack the $_POST['action'] == 'process' submission using an injectAppTop hook, generate the reset key myself, send the HTML email, and redirect the user before the core file runs. This works, but duplicating the core logic in a hook feels heavy.
My Question:
What is the recommended, upgrade-safe method for intercepting or overriding the password_forgotten.php email block to send an HTML template via a notifications module, given that it lacks a native trigger?
Thank you in advance for the guidance!