--- user_register_notify.module.orig	2009-01-20 18:08:12.000000000 -0800
+++ user_register_notify.module	2009-06-13 22:15:21.000000000 -0700
@@ -51,27 +51,26 @@ function user_register_notify_setup_emai
       'action' => $action,
     );
 
+    $emails = array();
     switch ($notify_type) {
       case 'Custom':
-        $to = variable_get('user_register_notify_mailto', $from);
+        $emails[] = variable_get('user_register_notify_mailto', $from);
         break;
       case 'Both':
-        $to = variable_get('user_register_notify_mailto', $from);
-        // There is no break there for a reson.
+        $emails[] = variable_get('user_register_notify_mailto', $from);
+        // There is no break here for a reson.
       case 'Role':
         $roles = implode(',', variable_get('user_register_notify_roles', array()));
         if (!empty($roles)) {
           $result = db_query("SELECT mail FROM {users} AS u INNER JOIN {users_roles} AS r ON u.uid = r.uid WHERE r.rid IN('%s')", $roles);
-          $emails = array();
           while ($mail = db_fetch_object($result)) {
             $emails[] = $mail->mail;
           }
-          if (!empty($emails)) {
-            $to = $to .' '. implode(', ', $emails);
-          }
         }
         break;
     }
+    $emails = array_unique($emails);
+    $to = implode(', ', $emails);
 
     watchdog('user_register_notify', check_plain($to));
 
@@ -112,7 +111,8 @@ function user_register_notify_mail($key,
     $langcode = $language->language;
     $uaccount = $params['account'];
     $action   = $params['action'];
-    $account_data = "";
+// [Ilya] This is unused, just creates a puzzling empty log entry.
+//    $account_data = "";
     $profile_data = "";
     $og_data = "";
 
@@ -168,7 +168,7 @@ function user_register_notify_mail($key,
       '!og' => check_plain($og_data),
       '!action' => $action == 'insert'? 'create' : 'update',
     );
-    watchdog('user_register_notify', check_plain($account_data));
+//    watchdog('user_register_notify', check_plain($account_data));
     $message['subject'] = t(variable_get('user_register_notify_subject', USER_REGISTER_NOTIFY_SUBJECT), $variables);
     $message['body'] = t(variable_get('user_register_notify_body', USER_REGISTER_NOTIFY_BODY), $variables);
   }
