Answers.Body: <p>This is fixed in CiviCRM 5.68+: <a href="https://github.com/civicrm/civicrm-core/pull/28354" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/28354</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-18T07:53:28.077Z
Answers.Text: Dang it, I could have save myself several hours of debugging! Mental note, check Github next time. Thanks @Jon G
Answers.UserDisplayName: Rob Squires
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-17T15:45:49.710Z
Answers.LastActivityDate: 2024-01-17T15:45:49.710Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Your analysis sounds good. Can you please open a pull-request on github with that change so it can be reviewed by Civi developers?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-17T13:41:20.123Z
Answers.LastActivityDate: 2024-01-17T13:41:20.123Z
Answers.UserDisplayName: Coleman
Body: <p>I am unable to get bounce processing working on more than one Plesk server, and think I may have found a bug in the CRM/Utils/Mail/IncomingMail.php file.</p>
  <p>Line 170 sets a regex string with the following code:</p>
  <pre><code>$rpXHeaderRegex = '/X-CiviMail-Bounce: ' . $emailLocalPart . '(b)' . $twoDigitString . '([0-9a-f]{16})@' . $emailDomain . '/i';
  </code></pre>
  <p>The '([0-9a-f]{16})@' part means that it is looking for a 16 digit string which can contain numbers, and the letters a - f.</p>
  <p>It is failing to find the string in my bounced mails though, because the 16 digit parts contain letters other than a - f.</p>
  <p>If I change the code to '([0-9a-z]{16})@', so it is looking for letters a - z, then bounce processing works properly.</p>
  <p>It seems there is a mismatch between the headers Civi is assigning when it sends the mail, and the headers it is looking for when it receives them back as a bounce.</p>
  <p>An example of an X-CiviMail-Bounce header in the bounced email is:</p>
  <pre><code>X-CiviMail-Bounce: bounces+b.86.404.vnqd0g7cqfjrdqqj@mydomain.com
  </code></pre>
  
Tags: <civimail><bounce-processing>
Title: Bounce processing and X-CiviMail-Bounce possible bug?
ThreadText: # Bounce processing and X-CiviMail-Bounce possible bug?
  
  (Asked by: username_0 on 2024-01-17)
  
  I am unable to get bounce processing working on more than one Plesk server, and think I may have found a bug in the CRM/Utils/Mail/IncomingMail.php file.
  
  Line 170 sets a regex string with the following code:
  
  ```
  $rpXHeaderRegex = '/X-CiviMail-Bounce: ' . $emailLocalPart . '(b)' . $twoDigitString . '([0-9a-f]{16})@' . $emailDomain . '/i';
  
  ```
  
  The '([0-9a-f]{16})@' part means that it is looking for a 16 digit string which can contain numbers, and the letters a - f.
  
  It is failing to find the string in my bounced mails though, because the 16 digit parts contain letters other than a - f.
  
  If I change the code to '([0-9a-z]{16})@', so it is looking for letters a - z, then bounce processing works properly.
  
  It seems there is a mismatch between the headers Civi is assigning when it sends the mail, and the headers it is looking for when it receives them back as a bounce.
  
  An example of an X-CiviMail-Bounce header in the bounced email is:
  
  ```
  X-CiviMail-Bounce: bounces+b.86.404.vnqd0g7cqfjrdqqj@mydomain.com
  
  ```
  
  **Tags:** civimail, bounce-processing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-01-17. Score: 1
  
  This is fixed in CiviCRM 5.68+: <https://github.com/civicrm/civicrm-core/pull/28354>
  
  > **Comments:**
  > **username_0**: Dang it, I could have save myself several hours of debugging! Mental note, check Github next time. Thanks @Jon G  
  
  ---
  
  ### Answer by username_2 on 2024-01-17. Score: 0
  
  Your analysis sounds good. Can you please open a pull-request on github with that change so it can be reviewed by Civi developers?
  
  
  ---
  
  