Index: email.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/email/email.module,v retrieving revision 1.9.2.8.4.12 diff -u -p -r1.9.2.8.4.12 email.module --- email.module 13 Jun 2009 19:01:32 -0000 1.9.2.8.4.12 +++ email.module 2 Jul 2009 18:44:53 -0000 @@ -381,14 +381,22 @@ function email_mail_page_form_submit($fo // 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. - $from = $form_state['values']['mail']; + if (variable_get('email_sender', '') == TRUE) { + $from = variable_get('site_mail', ''); + $params['no_reply_advice'] = TRUE; + } + else { + $from = $form_state['values']['mail']; + } $params['node'] = $node; $params['subject'] = $form_state['values']['subject']; $params['name'] = $form_state['values']['name']; $params['message'] = $form_state['values']['message']; $params['url'] = url('node/' . $node->nid, array('absolute' => TRUE)); - + $params['from'] = $form_state['values']['mail']; + + // Send the e-mail to the recipients: drupal_mail('email', 'contact', $email, language_default(), $params, $from); @@ -412,9 +420,11 @@ function email_mail($key, &$message, $pa case 'contact': $node = $params['node']; // Compose the body: - $msg[] = t('@name sent a message using the contact form at @node.', array('@name' => $params['name'], '@node' => $params['url']), $language->language); + $msg[] = t('@name (@from) sent a message using the contact form at @node.', array('@name' => $params['name'], '@node' => $params['url'], '@from' => $params['from']), $language->language); $msg[] = $params['message']; - + if($params['no_reply_advice']) { + $msg[] = t('Please do not reply directly to this message.'); + } // Tidy up the body: foreach ($msg as $index_key => $value) { $msg[$index_key] = wordwrap($value); @@ -462,5 +472,10 @@ function email_admin_settings() { '#default_value' => variable_get('email_hourly_threshold', 3), '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), ); + $form['email_sender'] = array('#type' => 'checkbox', + '#title' => t('Sending emails with sites email address as sender'), + '#default_value' => variable_get('email_sender', ''), + '#description' => t('For spam reasons it can be useful to enable this.'), + ); return system_settings_form($form); }