Browse Source

Change Errors-To and envelope-from see BT#11684

jmontoyaa 8 years ago
parent
commit
7ed4fba5cb
1 changed files with 5 additions and 3 deletions
  1. 5 3
      main/inc/lib/api.lib.php

+ 5 - 3
main/inc/lib/api.lib.php

@@ -7861,13 +7861,14 @@ function api_mail_html(
     $defaultEmail = $notification->getDefaultPlatformSenderEmail();
     $defaultName = $notification->getDefaultPlatformSenderName();
 
-    // Error to admin.
-    $mail->AddCustomHeader('Errors-To: '.$defaultEmail);
-
     // If the parameter is set don't use the admin.
     $senderName = !empty($senderName) ? $senderName : $defaultName;
     $senderEmail = !empty($senderEmail) ? $senderEmail : $defaultEmail;
 
+    // Errors to sender
+    $mail->AddCustomHeader('Errors-To: '.$senderEmail);
+    $mail->AddCustomHeader('envelope-from: '.$defaultEmail);
+
     // Reply to first
     if (isset($extra_headers['reply_to'])) {
         $mail->AddReplyTo(
@@ -7995,6 +7996,7 @@ function api_mail_html(
         }
     }
 
+
     // WordWrap the html body (phpMailer only fixes AltBody) FS#2988
     $mail->Body = $mail->WrapText($mail->Body, $mail->WordWrap);