Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.627
diff -u -r1.627 common.inc
--- includes/common.inc	6 Apr 2007 13:27:20 -0000	1.627
+++ includes/common.inc	11 Apr 2007 04:39:47 -0000
@@ -1960,14 +1960,23 @@
  *   FALSE otherwise.
  */
 function drupal_mail($mailkey, $to, $subject, $body, $from = NULL, $headers = array()) {
+  $default_from = variable_get('site_mail', ini_get('sendmail_from'));
+  // To prevent e-mail from looking like spam, the addresses in the Return-Path
+  // and Sender headers should have a domain authorized to use the originating
+  // SMTP server. Also, note RFC 821 Sec 4.1.1 says Return-Path goes first.
   $defaults = array(
     'MIME-Version' => '1.0',
     'Content-Type' => 'text/plain; charset=UTF-8; format=flowed',
     'Content-Transfer-Encoding' => '8Bit',
-    'X-Mailer' => 'Drupal'
+    'X-Mailer' => 'Drupal',
+    'Errors-To' => $default_from,
+    'Sender' => $default_from,
+    'Return-Path' => $default_from,
+    'From' => $default_from,
+    'Reply-to' => $default_from
   );
   if (isset($from)) {
-    $defaults['From'] = $defaults['Reply-To'] = $defaults['Return-Path'] = $defaults['Errors-To'] = $from;
+    $defaults['From'] = $defaults['Reply-To'] = $from;
   }
   $headers = array_merge($defaults, $headers);
 
