From dcfa5527657e647b4fa061862c500b9f9d82a17b Mon Sep 17 00:00:00 2001
From: Josh Richet <josh@joshrichet.com>
Date: Sun, 24 Apr 2016 15:25:32 -0700
Subject: [PATCH] FIX: Return-Path header is landing in spam boxes (#2985)

If the Return-Path header does not match the From header, emails are significantly more likely to be blocked by spam filters.

This patch forces the return header to match the from address without having to change php.ini and therefore works properly on servers that have multiple apps sending from multiple email addresses for example shared hosting, multiple support emails in one instance etc.
---
 include/class.mailer.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index cffaec5ed..b124ffd65 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -560,7 +560,8 @@ class Mailer {
         }
 
         //No SMTP or it failed....use php's native mail function.
-        $mail = mail::factory('mail');
+        $args = array('-f '.$this->getEmail()->getEmail());
+        $mail = mail::factory('mail', $args);
         // Ensure the To: header is properly encoded.
         $to = $headers['To'];
         $result = $mail->send($to, $headers, $body);
-- 
GitLab