Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.624
diff -u -r1.624 common.inc
--- includes/common.inc	27 Mar 2007 05:13:53 -0000	1.624
+++ includes/common.inc	29 Mar 2007 09:15:04 -0000
@@ -1966,6 +1966,10 @@
     'Content-Transfer-Encoding' => '8Bit',
     'X-Mailer' => 'Drupal'
   );
+
+  // Set the default envelope Return-Path address
+  $defaults['Return-Path'] = variable_get('site_mail', ini_get('sendmail_from'));
+
   if (isset($from)) {
     $defaults['From'] = $defaults['Reply-To'] = $defaults['Return-Path'] = $defaults['Errors-To'] = $from;
   }
@@ -2011,11 +2015,21 @@
     foreach ($headers as $name => $value) {
       $mimeheaders[] = $name .': '. mime_header_encode($value);
     }
+
+    // We specify the envelope Return-Path address in the additional_parameters
+    // to prevent PHP mail() from using the server's default Return-Path address
+    $return_path = mime_header_encode($headers['Return-Path']);
+    $additional_parameters = '';
+    if($return_path != ''){
+      $additional_parameters = '-f'. $return_path;
+    }
+
     return mail(
       $to,
       mime_header_encode($subject),
       str_replace("\r", '', $body),
-      join("\n", $mimeheaders)
+      join("\n", $mimeheaders),
+      $additional_parameters
     );
   }
 }
