--- /var/tmp/1/mailout/mailout_send.inc	2008-08-04 14:17:54.000000000 +0100
+++ mailout_send.inc	2008-09-17 16:16:27.000000000 +0100
@@ -8,6 +8,8 @@ define('MAILOUT_SEND_SEND', 'Send');
 define('MAILOUT_SEND_BACK', 'Back');
 define('MAILOUT_SEND_TEST', 'Send test email');
 
+define('MAILOUT_SEND_TO_HOOK', 'mailout_send_to');
+
 /**
  * callback for mailout/send
  *
@@ -143,7 +145,7 @@ function mailout_send_form($form_values 
   if (module_exists('og')) {
     $options_groups = og_all_groups_options();
     // This field allows sending of mailout to mailout lists.
-    if(count($group_array)) {
+    if(count($options_groups)) {
       $form_send_to['groups'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Send to Organic Group(s)'),
@@ -152,7 +154,24 @@ function mailout_send_form($form_values 
       );          
     }      
   }
-  
+
+  $custom_hooks = false;
+  foreach (module_implements(MAILOUT_SEND_TO_HOOK) as $module) {
+    if($module != 'mailout') {
+      if(!$custom_hooks) {
+        $custom_hooks = true;
+        $form_send_to['custom_send_to'] = array(
+          '#type' => 'fieldset',
+          '#title' => 'Custom Lists',
+          '#collapsible' => TRUE,
+          '#collapsed' => TRUE
+        );
+      }
+      $function = $module . '_' . MAILOUT_SEND_TO_HOOK;
+      $function(&$form_send_to['custom_send_to']);
+    }
+  }
+
   // Build Mailout list options.
   $form_send_to['email'] = array(
     '#type' => 'textarea',
@@ -444,6 +463,9 @@ function _mailout_send_collate_emails($f
   $emails = array_merge($emails, mailout_get_addresses_from_roles($form_values['roles'], FALSE));
   $emails = array_merge($emails, mailout_get_addresses_from_lists($form_values['lists'], FALSE));  
   $emails = array_merge($emails, mailout_get_addresses_from_text($form_values['email'], FALSE));
+  foreach($form_values['custom_send_to'] AS $custom_key => $custom_val) {
+    $emails = array_merge($emails, mailout_get_addresses_from_custom($custom_key, $form_values['custom_send_to'], FALSE));
+  }
   ksort($emails);
   return $emails;
 }
