You are here

protected function Notify::doSend in Automatic Updates 8

Composes and send the email message.

Parameters

string $to: The email address where the message will be sent.

array $params: Parameters to build the email.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to Notify::doSend()
Notify::send in src/Services/Notify.php
Send notification when PSAs are available.

File

src/Services/Notify.php, line 157

Class

Notify
Class EmailNotify.

Namespace

Drupal\automatic_updates\Services

Code

protected function doSend($to, array $params) {
  $users = $this->entityTypeManager
    ->getStorage('user')
    ->loadByProperties([
    'mail' => $to,
  ]);
  foreach ($users as $user) {
    $to_user = reset($users);
    $params['langcode'] = $to_user
      ->getPreferredLangcode();
    $this->mailManager
      ->mail('automatic_updates', 'notify', $to, $params['langcode'], $params);
  }
}