Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16584

Bounce management with Mandrill SMTP

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.2
    • Fix Version/s: 4.6.5, 4.6.9
    • Component/s: CiviMail
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      The mass mailing in CiviMail (CiviCRM 4.6.2) using Mandrilla SMTP service does not handle error mails.
      The problem to 2 causes in EmailProcessor.php :
      Regular Expression search in headers X-Bounce-CiviMail while header set in the mail is X-Civimail-Bounce (small m)!!
      Can be bypassed by an case insensitive search (/ i at the end of the regular expression).
      Code: [Select]
      // a regex for finding bound info X-Header
      $rpXheaderRegex = '/X-CiviMail-Bounce: ' . preg_quote($dao->localpart) . '(b)' . $twoDigitString . '([0-9a-f]

      {16}

      )@' . preg_quote($dao->domain) . '/i;
      // CiviMail in regex and Civimail in header !!!
      Errors are returned in a multipart mail, and the part containing the header X-Civimail-Bounce, generated by $ mail-> generateBody, is base64 encoded.
      One possible workaround is to look for parts of type ezcMailFile and search on the file content of this part.

      Code: [Select]
      if (!$matches and preg_match($rpXheaderRegex, $mail->generateBody(), $matches))

      { list($match, $action, $job, $queue, $hash) = $matches; }

      // Code added +++++++++
      // With Mandrilla, the X-CiviMail-Bounce header is produced by generateBody
      // is base64 encoded
      // Check all parts
      if (!$matches) {
      $all_parts=$mail->fetchParts();
      foreach ($all_parts as $k_part => $v_part) {
      if ($v_part instanceof ezcMailFile) {
      $p_file = $v_part->__get('fileName');
      $c_file=file_get_contents($p_file);
      if (preg_match($rpXheaderRegex, $c_file, $matches))

      { list($match, $action, $job, $queue, $hash) = $matches; }

      }
      }
      }
      // +++++++++
      // if all else fails, check Delivered-To for possible pattern

      Theses changes are made in CiviCRM 4.6.2 and now bouncing work like a charme (in Mandrilla and in CiviCRM).

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              olivier Olivier
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: