πŸ‡­πŸ‡ΊHungary @lv46gl

Account created on 1 June 2008, about 16 years ago
#

Recent comments

πŸ‡­πŸ‡ΊHungary lv46gl

What about this solution?

      // Set a dummy no reply email if email list is not empty.
      $to = empty($admin_email) ? \Drupal::config('system.site')->get('mail') : 'noreply@noreply.com';
      $params = [
        'body' => $body,
        'subject' => $subject,
        'nid' => $node->id(),
      ];

      // Allow to alter $admin_email
      // by using hook_admin_content_notification_recipients_alter().
      // @see admin_content_notification.api.php
      \Drupal::moduleHandler()
        ->alter('admin_content_notification_recipients', $admin_email, $node);

//  delete ->    if (!empty($admin_email)) {
//  delete ->      $params['bcc'] = $admin_email;
//  delete ->    }

      // Allow to alter $params
      // by using hook_admin_content_notification_params_alter().
      // @see admin_content_notification.api.php
      \Drupal::moduleHandler()
        ->alter('admin_content_notification_params', $params, $node);

      if (strlen($admin_email) === 0) {
        return;
      }
      $key = 'admin_content_notification_key';
      if (empty($to) || empty(\Drupal::config('system.site')->get('mail'))) {
        $this->getLogger('admin_content_notification')->error($this->t('From and To email addresses should not be empty.'));
        return;
      }
      foreach (explode(',', $admin_email) as $to) {       // <- insert
        $this->mailManager->mail('admin_content_notification', $key, $to, 'en', $params, \Drupal::config('system.site')->get('mail'), TRUE);
      }                                                   // <- insert

Production build 0.69.0 2024