CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • General Discussion (please no support requests here!) (Moderator: Michał Mach) »
  • CiviMail mass mailing and Mandrilla
Pages: [1]

Author Topic: CiviMail mass mailing and Mandrilla  (Read 540 times)

olivier

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.4
CiviMail mass mailing and Mandrilla
May 21, 2015, 09:48:26 am
hi,

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).

Hope this can help.

Olivier.

kathleenrueb

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
    • custom essay writing service
  • CiviCRM version: CiviCRM 3.4
  • CMS version: CMS 3.2.1
  • MySQL version: MySQL 5.7
  • PHP version: PHP 5.3
Re: CiviMail mass mailing and Mandrilla
June 03, 2015, 12:17:28 am
Really appreciate your effort on spotting the errors. I haven't noticed it before. Hope the code would definitely help to correct the errors.
best custom writing service

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • General Discussion (please no support requests here!) (Moderator: Michał Mach) »
  • CiviMail mass mailing and Mandrilla

This forum was archived on 2017-11-26.