Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By kraken on
Is there a way to change where the user registration notification email goes to? Right now it goes to the email address specified in Administration » Configuration » System » Site information. I would like to make it go to another email instead.
I prefer to do it through code or the Drupal admin and not add another module.
Could I do this using hook_form_alter targeting "user_register_form" or is there another way?
Comments
You should be able to change
You should be able to change the To address of an email by creating a custom module and implementing hook_mail_alter.
I did something similar to
I did something similar to this recently. The code looked something like this:
Thanks, your suggestion
Thanks, your suggestion helped me do it. If anyone else is looking to do this, the message ids I used are:
Created a Rule
I just did this by creating a rule in D7.
Event: After saving a new user account
Conditions: Entity is of type: User AND Data Comparison: Account:Status == Blocked (so no email is sent if account created by admin.)
Actions: Send mail to all users of a role (this could also be a specific email address)
The condition "User is
The condition "User is blocked" is simpler.
http://www.fonant.com - Fonant Ltd - Quality websites