Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.8
-
Fix Version/s: None
-
Component/s: CiviMail
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
My SMTP server returns bounces to the sender regardless of what it's given as Return-Path.
Studying CiviCRM code I saw that I could make bounce processing work anyway because in /sites/all/modules/civicrm/CRM/Utils/Mail/EmailProcessor.php the entire email body was scanned to find a 'Return-Path'.
So. why didn't it work?
Because there was no space between 'Return-Path' and the rest.
I changed the regular expression:
// a tighter regex for finding bounce info in soft bounces’ mail bodies
// EMS 2015-10-15 fixing return path regex
//$rpRegex = '/Return-Path: ' . preg_quote($dao->localpart) . '(b)' . $twoDigitString . '([0-9a-f]
$rpRegex = '/Return-Path:\s*' . preg_quote($dao->localpart) . '(b)' . $twoDigitString . '([0-9a-f]{16}
)@' . preg_quote($dao->domain) . '/';
Now it works because it finds a match regardless of the space being there or not.