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 the To address of an email by creating a custom module and implementing hook_mail_alter.

I did something similar to this recently. The code looked something like this:

function mymodule_mail_alter(&$message) {
  if ($message['id'] == $my_id) {
    $email_address = mymodule_get_manager_email($gid);
    $message['to'] = $email_address;
  }
}

Systemick
Drupal is the daddy of all content management systems.
www.systemick-drupal-development.co.uk

Thanks, your suggestion helped me do it. If anyone else is looking to do this, the message ids I used are:

<?php
$message
['id'] == "user_register_pending_approval"; // for email to registrant
$message['id'] == "user_register_pending_approval_admin"; // // for email to admin
?>

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 blocked" is simpler.

http://www.fonant.com - Fonant Ltd - Quality websites