diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index b36d002..32dad1c 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -29,7 +29,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { * @return array */ public static function createAngularSettings():array { - $reportIds = []; + $reportIds = $testEmail = []; $reportTypes = ['detail', 'opened', 'bounce', 'clicks']; foreach ($reportTypes as $report) { $rptResult = civicrm_api3('ReportInstance', 'get', [ @@ -80,6 +80,12 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'option_group_id' => "from_email_address", 'domain_id' => CRM_Core_Config::domainID(), ]); + try { + $testEmail = civicrm_api3('Contact', 'getvalue', [ + 'id' => 'user_contact_id', + 'return' => 'email', + ]); + } catch (\Throwable $th) {} $enabledLanguages = CRM_Core_I18n::languages(TRUE); $isMultiLingual = (count($enabledLanguages) > 1); // FlexMailer is a refactoring of CiviMail which provides new hooks/APIs/docs. If the sysadmin has opted to enable it, then use that instead of CiviMail. @@ -101,10 +107,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { 'disableMandatoryTokensCheck' => (int) Civi::settings() ->get('disable_mandatory_tokens_check'), 'fromAddress' => $fromAddress['values'], - 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', [ - 'id' => 'user_contact_id', - 'return' => 'email', - ]), + 'defaultTestEmail' => $testEmail, 'visibility' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::groupVisibility()), 'workflowEnabled' => CRM_Mailing_Info::workflowEnabled(), 'reportIds' => $reportIds,