dev/core#2907 parse subject for tokens
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 25 Jul 2023 01:28:26 +0000 (13:28 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 26 Jul 2023 00:03:21 +0000 (12:03 +1200)
CRM/Mailing/Event/BAO/MailingEventSubscribe.php

index 5fbcf34872f607988133d18601a39328d9f67b58..2451c617bb1605530ca1d068e9bd1c2ea2666c57 100644 (file)
@@ -197,7 +197,6 @@ SELECT     civicrm_email.id as email_id
     $component->find(TRUE);
 
     $params = [
-      'subject' => $component->subject,
       'from' => "\"{$domainEmailName}\" <{$domainEmailAddress}>",
       'toEmail' => $email,
       'replyTo' => $confirm,
@@ -237,18 +236,18 @@ SELECT     civicrm_email.id as email_id
 
     $tokenProcessor->addMessage('body_html', $html, 'text/html');
     $tokenProcessor->addMessage('body_text', $text, 'text/plain');
+    $tokenProcessor->addMessage('subject', $component->subject, 'text/plain');
     $tokenProcessor->addRow(['contactId' => $this->contact_id, 'groupId' => $this->group_id]);
     $tokenProcessor->evaluate();
-    $html = $tokenProcessor->getRow(0)->render('body_html');
-    $text = $tokenProcessor->getRow(0)->render('body_text');
+    $params['html'] = $tokenProcessor->getRow(0)->render('body_html');
+    $params['text'] = $tokenProcessor->getRow(0)->render('body_text');
+    $params['subject'] = $tokenProcessor->getRow(0)->render('subject');
 
     CRM_Mailing_BAO_Mailing::addMessageIdHeader($params, 's',
       $this->contact_id,
       $this->id,
       $this->hash
     );
-    $params['html'] = $html;
-    $params['text'] = $text;
     if (CRM_Core_BAO_MailSettings::includeMessageId()) {
       $params['messageId'] = $params['Message-ID'];
     }