--- email.old 2007-04-16 23:58:32.000000000 -0600 +++ email.module 2007-06-13 11:27:46.000000000 -0600 @@ -77,7 +77,8 @@ function email_field_formatter($field, $ } else { if ($field['widget']['link_type'] == 'form' || $formatter == 'contact') { - $mailto = l(t('Email Contact Form'), 'email/'.$node->nid.'/'.$field['field_name']); + $indexVal = array_search($item, $node->{$field['field_name']}); + $mailto = l(t('Email Contact Form'), 'email/'.$node->nid.'/'.$field['field_name'].'/'. $indexVal); } elseif (($field['widget']['link_type'] == 'mailto_encrypt' || $formatter == 'invisi') && module_exists('invisimail')) { $format = $GLOBALS['invisimail_format']; @@ -232,11 +233,13 @@ function email_menu($may_cache) { /** * The contact form page. */ -function email_mail_page($nid=null, $fieldname=null) { - if (empty($nid) || empty($fieldname)) { +function email_mail_page($nid=null, $fieldname=null, $indexval=null) { + if (empty($nid) || empty($fieldname) || empty($indexval)) { drupal_not_found(); return; } + + $node = node_load(intval($nid)); if (!$node) { drupal_not_found(); @@ -321,7 +324,8 @@ function email_mail_page_form_validate($ function email_mail_page_form_submit($form_id, $edit) { $nid = intval(arg(1)); $fieldname = arg(2); - if (empty($nid) || empty($fieldname)) { + $indexval = intval(arg(3)); + if (empty($nid) || empty($fieldname) || empty($indexval)) { drupal_not_found(); return; } @@ -343,7 +347,7 @@ function email_mail_page_form_submit($fo drupal_not_found(); return; } - $email = $field[0]['email']; + $email = $field[$indexval]['email']; // E-mail address of the sender: as the form field is a text field, // all instances of \r and \n have been automatically stripped from it.