--- feedback-real.module	2006-09-01 04:03:58.000000000 -0500
+++ feedback-old.module	2006-09-11 10:56:30.000000000 -0500
@@ -175,7 +175,7 @@ function feedback_settings_form($pagenam
     '#default_value' => $page->field_category,
     '#cols' => 40,
     '#rows' => 6,
-    '#description' => t('Put each subject category on a separate line or separate them by commas.  No HTML allowed.').'<br />'.t('Leave this field empty to disable this feature.'),
+    '#description' => t('Put each subject category on a separate line or separate them by commas.  No HTML allowed. Optionally add [mailto:address@example.com] after each subject to have feedback for that subject sent to an address other than the default.').'<br />'.t('Leave this field empty to disable this feature.'),
   );
   $form['fields'] = array(
     '#type' => 'fieldset',
@@ -461,7 +461,11 @@ function feedback_mail_page_submit($form
   // Prepare the body:
   $body = implode("\n\n", $message);
 
-  $category = $page->field_category ? ' ['.$edit['category'].'] ' : ' ';
+  // If the category has the [mailto:(.*?)] then we extract the e-mail address and use it
+  $extracted = _feedback_filter_category( $edit['category'] );
+  $page->email = ( $extracted['email'] ) ? $extracted['email'] : $page->email;
+
+  $category = $page->field_category ? ' ['.$extracted['category'].'] ' : ' ';
   $subject = $page->subject_prefix . $category . $edit['subject'];
 
   // Send the e-mail to the recipients:
@@ -522,12 +526,26 @@ function feedback_prepare_mailtext($stri
   return html_entity_decode(strip_tags($string), ENT_QUOTES);
 }
 
+function _feedback_filter_category($string) {
+  preg_match( '/(.*?)\[mailto:(.*?)\]/', $string, $matches );
+  $values = array();
+  if ( count( $matches ) ) {
+    $values['email'] = $matches[2];
+    $values['category'] = $matches[1];
+  } else {
+    $values['category'] = $string;
+  }
+  return $values;
+}
+
 function _feedback_get_options($text) {
   $options = array ('0' => '--');
   $lines = split("[,\n\r]", $text);
   foreach ($lines as $line) {
     if ($line = trim($line)) {
-      $options[$line] = $line;
+      // strip e-mail addresses if any
+      $matches = _feedback_filter_category($line);
+      $options[$line] = trim($matches['category']);
     }
   }
   return $options;
