Index: user_register_notify_php/user_register_notify_php.info
===================================================================
--- user_register_notify_php/user_register_notify_php.info	(revision 0)
+++ user_register_notify_php/user_register_notify_php.info	(revision 0)
@@ -0,0 +1,6 @@
+name = User registration notification PHP
+description = Extends User Register Notify module with variable settings via PHP
+dependencies[] = user_register_notify
+version = "6.x-0.1"
+core = "6.x"
+project = "user_register_notify_php"
\ No newline at end of file
Index: user_register_notify_php/user_register_notify_php.install
===================================================================
--- user_register_notify_php/user_register_notify_php.install	(revision 0)
+++ user_register_notify_php/user_register_notify_php.install	(revision 0)
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @file
+ *   User Registry Notify PHP module install/schema hooks.
+ */
+
+/**
+ * Implementation of hook_install().
+ * This will install the module, create the neccesary variables and database
+ */
+function user_register_notify_php_install() {
+  db_query("UPDATE {system} SET weight = 1 WHERE name = 'user_register_notify_php'");
+  drupal_set_message(st('User Registry Notify PHP module installed successfully.'));
+}
\ No newline at end of file
Index: user_register_notify_php/user_register_notify_php.module
===================================================================
--- user_register_notify_php/user_register_notify_php.module	(revision 0)
+++ user_register_notify_php/user_register_notify_php.module	(revision 0)
@@ -0,0 +1,66 @@
+<?php
+
+/**
+ * This module extends user_register_notify.module so that
+ * the custom email address can be set variably through PHP
+ *
+ * Module developed by Bartezz for cannedconcept.com
+ *
+ * @author Bartezz <bartezz@gmail.com>
+ */
+ 
+ 
+/**
+ * Implementation of hook_perm().
+ */
+function user_register_notify_php_perm() {
+  return array('use PHP for user register notify');
+}
+
+/**
+ * Implementation of hook_form_alter().
+ */
+function user_register_notify_php_form_alter(&$form, &$form_state, $form_id) {
+  if ($form_id == 'user_register_notify_settings') {
+      $form['user_notify']['user_register_notify_type']['#title'] = t('Send by Role, Custom Email or Variable address?');
+      $form['user_notify']['user_register_notify_type']['#options']['PHP'] = t('Use PHP to return an email address.');
+      $form['user_notify']['user_register_notify_php'] = array(
+        '#type' => 'textarea',
+        '#title' => t('Send notifications to variable email address(es)'),
+        '#description' => t('You may post PHP code to return an email address, multiple email address may be separated by a comma. Should not include &lt;?php ?&gt; delimiters. The $account array is provided for use. If nothing is returned, the site email address %mailto will be used.' , array('%mailto' => variable_get('site_mail', ini_get('sendmail_from')))),
+        '#default_value' => variable_get('user_register_notify_php', variable_get('site_mail', ini_get('sendmail_from'))),
+      );
+    if (!user_access('use PHP for user register notify')) {
+      drupal_set_message(t('You do not have permissions to enter or edit PHP code to return email address(es).'), 'warning');
+      $form['user_notify']['user_register_notify_php']['#attributes']['readonly'] = 'readonly';
+      if (variable_get('user_register_notify_type', 'Custom') == 'PHP') {
+        $form['user_notify']['#collapsed'] = TRUE;
+      }
+    }
+  }
+}
+
+/**
+ * Implementation of hook_mail_alter().
+ */
+function user_register_notify_php_mail_alter(&$message) {
+  if ($message['id'] == 'user_register_notify_user-register-notify-admin' && variable_get('user_register_notify_type', 'Custom') == 'PHP') {
+    $notify_type = variable_get('user_register_notify_type', 'Custom');
+    if ($notify_type == 'PHP') {
+      $command = variable_get('user_register_notify_php', variable_get('site_mail', ini_get('sendmail_from')));
+      $account = (array)$message['params']['account'];
+      $emails = explode(',', drupal_eval('<?php $account = ' . var_export($account, TRUE) . '; ' . $command . ' ?>'));
+      array_walk($emails, create_function('&$v', '$v = trim($v);'));
+      $sitemail = variable_get('site_mail', ini_get('sendmail_from'));
+      foreach ($emails as $k => $email) {  
+        if (!valid_email_address($email)) {
+          watchdog('User Register Notify PHP', 'The e-mail address %originalmail is not valid, the notification has been sent to %replacementmail', array('%originalmail' => $email, '%replacementmail' => $sitemail), WATCHDOG_NOTICE, l(t('edit'), 'admin/settings/register_notify'));
+          $emails[$k] = $sitemail;        
+        }
+      }      
+      $emails = array_unique($emails);
+      $to = implode(', ', $emails);
+      $message['to'] = $to;
+    }
+  }
+}
\ No newline at end of file
