Merge pull request #14898 from eileenmcnaughton/export_rel
[civicrm-core.git] / api / v3 / Mailing.php
index aec00c43d0cd076583867ea5f1645d554d42c9ec..a71e5645d96f8ba969693eeecd8be2a227d24634 100644 (file)
@@ -594,7 +594,7 @@ function civicrm_api3_mailing_preview($params) {
   return civicrm_api3_create_success([
     'id' => $mailingID,
     'contact_id' => $contactID,
-    'subject' => $mime->headers()['Subject'],
+    'subject' => CRM_Utils_Array::value('Subject', $mime->headers(), ''),
     'body_html' => $mime->getHTMLBody(),
     'body_text' => $mime->getTXTBody(),
   ]);
@@ -639,7 +639,9 @@ function civicrm_api3_mailing_send_test($params) {
   $testEmailParams['is_test'] = 1;
   $testEmailParams['status'] = 'Scheduled';
   $testEmailParams['scheduled_date'] = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s'));
+  $testEmailParams['is_calling_function_updated_to_reflect_deprecation'] = TRUE;
   $job = civicrm_api3('MailingJob', 'create', $testEmailParams);
+  CRM_Mailing_BAO_Mailing::getRecipients($testEmailParams['mailing_id']);
   $testEmailParams['job_id'] = $job['id'];
   $testEmailParams['emails'] = array_key_exists('test_email', $testEmailParams) ? explode(',', strtolower($testEmailParams['test_email'])) : NULL;
   if (!empty($params['test_email'])) {