Skip to content

Commit

Permalink
refs #42663, fixes sometime mailing job doesn't mark delivered and se…
Browse files Browse the repository at this point in the history
…nd duplicate email to recipients
  • Loading branch information
jimyhuang committed Feb 8, 2025
1 parent 526783c commit 1721746
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CRM/Mailing/BAO/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,20 @@ public function deliverGroup(&$fields, &$mailing, &$mailer, &$job_date, &$attach
FALSE, NULL, $replyToEmail
);

// handling compose failing
if (empty($message) || !is_object($message) || !is_a($message, 'Mail_mime')) {
CRM_Core_Error::debug_log_message("Failed to compose message for queue: {$field['id']}, contact {$field['contact_id']}, email {$field['email']}");
$params = array(
'event_queue_id' => $field['id'],
'job_id' => $this->id,
'hash' => $field['hash'],
);
$params = array_merge($params, CRM_Mailing_BAO_BouncePattern::match('Mailing compose system error, check system log for detail.'));
CRM_Mailing_Event_BAO_Bounce::create($params);

continue;
}

/* Send the mailing */
$body = &$message->get();
$headers = &$message->headers();
Expand Down

0 comments on commit 1721746

Please sign in to comment.